There is a batch jcl in our shop which runs every 15 min and FTP's a file (Mainframe flat file) to another UNIX Server. The unix server has its own limitations and it can't receive the file with size more than 550 KB.
I been asked to split the file into two or more files when we receive the file with size more than 550 KB.
Is there any way we can meet this requirement with DFSORT?
The file will have Header followed by detail records. We are not sure how many records we receive in a run.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
What is the RECFM and LRECL of the input file?
I assume you want to use DFSORT to split the file into two files so you can FTP the two files separately ... right?
Since you said the server limit is 550KB and you want to split the file into two files, can we assume that the input file will never be greater than 2*550KB?
Do you need the header in both of the resulting files? If so, is there something unique in the Header record that identifies it? What?
Thanks you very much for looking at the issue.
Please find my responses below:
What is the RECFM and LRECL of the input file?
RECFM = VB, LRECL = 21 For Header, 23 For Detail Record.
I assume you want to use DFSORT to split the file into two files so you can FTP the two files separately ... right?
YES. Each file should not exceed the file size 550KB.
Since you said the server limit is 550KB and you want to split the file into two files, can we assume that the input file will never be greater than 2*550KB?
YES. We can assume that the input file will not have the size more than 2*550KB.
Do you need the header in both of the resulting files? If so, is there something unique in the Header record that identifies it? What?
YES. The header and detail records will have field called RECORD TYPE. The record type for header is '0' and for the detail record is '1'.
The detail records should be FTP'd along with header record. We can't send detail records separately. Basically the input file will have the store orders. The store orders will be FTP'd to vendor for further processing.
The header will have the store number and the detail record will have the orders for the store. So while FTP'ing we can send the header record along with all the detail records it is having.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
RECFM = VB, LRECL = 21 For Header, 23 For Detail Record.
A file can only have one LRECL (the maximum length for the records in the VB file). I think you are giving the lengths of the individual records. But since it's VB, I don't really need to know the LRECL.
Does the DFSORT job have to handle the case when the input file is <= 550KB by producing only one output file? Or does the DFSORT job only have to handle the case when the input file > 550KB by producing two output files? The latter would be easier.
What is the starting position of the RECORD TYPE in the header record (remember to count the RDW in positions 1-4)?
A file can only have one LRECL (the maximum length for the records in the VB file). I think you are giving the lengths of the individual records. But since it's VB, I don't really need to know the LRECL.
Does the DFSORT job have to handle the case when the input file is <= 550KB by producing only one output file? Or does the DFSORT job only have to handle the case when the input file > 550KB by producing two output files? The latter would be easier.
I think we can go ahead with the later case. We produce two files only when the recieved file size is >550KB.
What is the starting position of the RECORD TYPE in the header record (remember to count the RDW in positions 1-4)?
The first byte field is the RECORD TYPE. (Position '1')
Here is the record layout:
Code:
01 ORD-HDR-INPUT.
05 ORD-RECD-TYPE PIC X(01) VALUE SPACE.
05 ORD-SRCE PIC X(01) VALUE SPACE.
05 ORD-FRMT PIC X(01) VALUE SPACE.
05 ORD-APPLCTN PIC X(02) VALUE SPACE.
05 ORD-CUST-NBR PIC 9(04) VALUE ZERO.
05 ORD-DLVD-DATE PIC 9(04) VALUE ZERO.
05 ORD-SRL-NO PIC X(08) VALUE SPACE.
01 ORD-DTL-INPUT.
05 ORDTLI-RECD-TYPE PIC X(01) VALUE SPACE.
05 ORDTLI-RTL-DPT-BKR PIC 9(03) VALUE ZERO.
05 ORDTLI-ITM-UPC-IND PIC X(01) VALUE SPACE.
05 ORDTLI-ITM-CODE-UPC PIC 9(13) VALUE ZERO.
05 ORDTLI-QTY-ORDERED PIC 9(04) VALUE ZERO.
05 ORDTLI-LBL-IND PIC X(01) VALUE SPACE.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
I believe this DFSORT/ICETOOL job will do what you asked for. It uses a running total of the record lengths to determine where to split the records and dynamically sets up OUTFIL statements to do the split. The header (first) record is retained in each output file.
I just ran the job which you have provided. The job running well and splitting the file in two when I provide the file having size more than 550KB. I will go ahead and do some testing in different scenarios.