IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Splitting a file by file size (bytes)


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arif677

New User


Joined: 22 Jun 2005
Posts: 11

PostPosted: Fri Aug 08, 2008 3:16 am
Reply with quote

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.

I would appreciate your help.

Thanks,
Mohamad.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Aug 08, 2008 4:25 am
Reply with quote

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?
Back to top
View user's profile Send private message
arif677

New User


Joined: 22 Jun 2005
Posts: 11

PostPosted: Fri Aug 08, 2008 8:46 pm
Reply with quote

Hi Yaeger,

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.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Aug 08, 2008 9:27 pm
Reply with quote

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)?
Back to top
View user's profile Send private message
arif677

New User


Joined: 22 Jun 2005
Posts: 11

PostPosted: Sat Aug 09, 2008 12:54 am
Reply with quote

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.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Aug 09, 2008 1:40 am
Reply with quote

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.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG   DD  SYSOUT=*
//IN DD DSN=...  input file (VB)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//C1 DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//CTL3CNTL DD DSN=&&C2,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//OUT1 DD DSN=...  output file1 (VB)
//OUT2 DD DSN=...  output file2 (VB)
//TOOLIN   DD    *
COPY FROM(IN) USING(CTL1)
COPY FROM(C1) USING(CTL2)
COPY FROM(T1) USING(CTL3)
//CTL1CNTL DD *
  INREC BUILD=(1,4,5:SEQNUM,8,ZD,13:1,2,15:5)
  OUTFIL FNAMES=T1
  OUTFIL FNAMES=C1,REMOVECC,NODETAIL,
    SECTIONS=(5,8,
      TRAILER3=(5,8,SUBTOT=(13,2,BI,TO=ZD,LENGTH=8)))
/*
//CTL2CNTL DD *
  OPTION STOPAFT=1
  INCLUDE COND=(13,8,ZD,GT,+563200)   <-- 550KB
  OUTFIL FNAMES=CTL3CNTL,VTOF,
    BUILD=(C' OUTFIL FNAMES=OUT1,',/,
     C'  INCLUDE=(5,8,ZD,LT,',5,8,C'),'/,
     C'  BUILD=(1,4,5:15)',80:X,/,
     C' OUTFIL FNAMES=OUT2,',/,
     C'  INCLUDE=(5,8,ZD,EQ,1,OR,5,8,ZD,GE,',5,8,C'),',/,
     C'  BUILD=(1,4,5:15)')
/*
Back to top
View user's profile Send private message
arif677

New User


Joined: 22 Jun 2005
Posts: 11

PostPosted: Sat Aug 09, 2008 2:20 am
Reply with quote

Hi Yaeger,

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.

Thank you very much.

Mohamad.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top