4GL, Fixed Length Record with Trailing spaces

 3 Replies
 0 Subscribed to this topic
 17 Subscribed to this forum
Sort:
Author
Messages
pvhmc
Basic Member Send Private Message
Posts: 5
Basic Member
Writing out a data file using 4GL. Each line in my file is fixed width of 750 characters. But the last populated field is at character 650. The remaining fields are populated with spaces. When I define the workfile to be TAPE, the line of my file ends at 650 (last non-space character). I need the file to place the carriage return-line feed at 750. Is there a pure 4GL way to accomplish this. (I am not going to be able to script this out on Unix after the fact.)

I know I could make the workfile sequential and chop it up at 750 chars using cnvexp, but again, I cannot script that to happen (though I could do it with WS-COMMAND).
Sam Simpson
Veteran Member Send Private Message
Posts: 239
Veteran Member
It's been awhile since I used carriage return in fixed format files and I could not find my old sample. However I thought if you are using TAPE then you have to create tape control character (HEX 13). Here's an example and hope it helps.

MOVE 19 (HEX 13) TO WS-IBMSL-VALUE IN PD FOR TAPEMARK
CHARACTER IN WS-IBMSL-TAPEMARK.

02 WS-IBMSL-TAPEMARK.
03 WS-TP PIC X(01) VALUE SPACES.
02 WS-IBMSL-VALUE REDEFINES WS-IBMSL-TAPEMARK
PIC 9(02) COMP.


For more information, please refer to PR299 cobol program.
John Henley
Send Private Message
Posts: 3355
I think it's much easier if you just create a script that uses cnvexp, and call it from within your program...I use that technique all the time.
Thanks for using the LawsonGuru.com forums!
John
Sam Simpson
Veteran Member Send Private Message
Posts: 239
Veteran Member
Now I just remembered how I did it. from previous posting you initialize WS-IBMSL-TAPEMARK by moving 19 to WS-IBMSL-VALUE. Then put WS-TP as the last
character of your record. The only thing I'm not sure is the placement 750 or 751 byte.
You have to test this one.

And as John said you can also use cnvexp in a script and called within the same program.