Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to write variable length records?

Status
Not open for further replies.

DougInHuntValley

Technical User
Apr 8, 2008
1
0
0
US
After 16 years away from REXX, I have an assignment to do, and of course, a problem. The last problem, not getting any data in my output file took me an hour to find the missing period on the stem name.

Now, I am trying to write out a variable length file, but every record
is being padded with spaces to the maximum size. My max LRECL is
247, being set for me. When I set it in the ALLOC to 100, I had the same problem.

I am using ISPEDIT with HEX ON to see that I have spaces at the end of my records.

How do I make the EXECIO ... DISKW write out the entire stem as
variable length, only as long as the data I placed in it? Any
assistance or pointers to the page I missed in a manual would be most welcome.

Doug

ixformrec=ixformrec+1
formrec.ixformrec=mem||delim||delim||delim,
||formtag||delim||formvers||delim,
||formdate||delim||userid
IF debug = 1 THEN SAY "Output Rec:" formrec.ixformrec

END /* completes the do loop for trap.0 */
"DEL @WORK.HDR";
"ALLOC F(OUTHDR) DA(@WORK.HDR) NEW CATaLoG UNIT(TPUB) SPACE(20,20)",
" recfm(v b) lrecl(120) "
SAY formrec;
SAY "ABout to write out header file";
"EXECIO 0 DISKW OUTHDR (OPEN"
IF RC != 0 THEN SAY 'Open header failed' RC
"EXECIO " ixformrec " DISKW OUTHDR (STEM formrec."
IF RC <> 0 THEN SAY 'write header failed' RC
"EXECIO 0 DISKW OUTHDR (FINIS"
IF RC <> 0 THEN SAY 'close header failed' RC

 
In ISPF EDIT the editor always shows every record as if it were MAXRECL bytes. Think about it... There's no "end-of-record" marker in MVS; the length is held in the 2-byte length prefix and the record is as long as that prefix says it is. The next datum after the record is the next record's length-prefix.

So, just because it looks (on the screen) as if it's a fixed-length record doesn't mean it is a fixed-length record.


Frank Clarke
Support the Troops:
-- Bring them home.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top