First option: use DFSORT (one step per DSN) to copy your input data. You can
use the OUTREC control card to force the data to be of a standard length,
padding with blanks or x'00' or whatever. Then process the new, padded, data
sets using normal COBOL.
===
Now, if you could make the file definition VARIABLE and force the incoming
files to be RECFM=VB, then it is still fairly easy. The COBOL FD would then
look something like:
FD INLOG
RECORD IS VARYING IN SIZE FROM 1 TO 133
DEPENDING ON WS-INLOG-RECORD-LENGTH
RECORDING MODE IS V
LABEL RECORDS ARE OMITTED.
(note 133 is my max in the program I was writing, change to your max).
When you read the record, the variable WS-INLOG-RECORD-LENGTH (PIC 9999) will
contain the size of the record read. You could then MOVE it to a fixed length
area using "reference modification", like:
MOVE INLOG-RECORD(1:WS-INLOG-RECORD-LENGTH) TO FIXED-DATA-AREA.
This will copy the input to a fixed output (or work) area, padded with blanks.
If you want it padded with LOW-VALUES (or something else), you could do:
MOVE ALL LOW-VALUES TO FIXED-DATA-AREA.
MOVE INLOG-RECORD(1:WS-INLOG-RECORD-LENGTH) TO
FIXED-DATA-AREA(1:WS-INLOG-RECORD-LENGTH).
===
If you want to be truly weird and the data is textual (no unprintable binary),
put the data in a z/OS UNIX file instead of a sequential data set. Then read
the file as you normally would in your COBOL program as FIXED, using a DD
similar to:
//INPUT DD PATH='/some/directory/input.data',
// PATHOPTS=(ORDONLY),
// RECFM=FB,LRECL=???,BLKSIZE=???,
// FILEDATA=TEXT
Since all normal z/OS UNIX text files are delimited by a NEL (x'15'), they are
inherently variable length. But if you put RECFM=FB,LRECL=??? (replace ??? with
max record length), then QSAM will read the logical record from UNIX and
automagically pad it with blanks if it is short.
No, I am not really suggesting this. It's just my desire to do things strangely.
--
John McKown
Systems Engineer IV
IT
Administrative Services Group
HealthMarkets®
9151 Boulevard 26 • N. Richland Hills • TX 76010
(817) 255-3225 phone •
[email protected] • www.HealthMarkets.com
Confidentiality Notice: This e-mail message may contain confidential or
proprietary information. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original message.
HealthMarkets® is the brand name for products underwritten and issued by the
insurance subsidiaries of HealthMarkets, Inc. –The Chesapeake Life Insurance
Company®, Mid-West National Life Insurance Company of TennesseeSM and The MEGA
Life and Health Insurance Company.SM
> -----Original Message-----
> From: IBM Mainframe Discussion List [mailto:[email protected]]
> On Behalf Of Ron Thomas
> Sent: Thursday, October 18, 2012 12:43 PM
> To: [email protected]
> Subject: File Processing
>
> Hello
>
> I have a requirement where the input file is comming from a thrid
> party system and each of the files is having different logical record
> lengths. Once the file cam i have to use the file and encrypt the
> customer number that is there. Please let me know how in a single
> cobol program we can acheive the same?
>
> Regards
> Ron T
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions, send
> email to [email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN