IBM MAINFRAME HELP FORUMS for COBOL, JCL, CICS, DB2, IMS etc...
Help & Support Forums for IBM Mainframe computers Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7, CA-11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, VSAM, ISPF, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

Splitting and merging header trailer

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> DFSORT/ICETOOL
View previous topic :: View next topic  
Author Message
rarvins



Joined: 24 Jan 2007
Posts: 46
Location: India

Posted: Tue Jul 01, 2008 7:59 pm    Post subject: Splitting and merging header trailer  

I have a cobol program that takes in a huge file (with records in the order of millions) and it splits it into multiple files. It also adds header and trailer while doing the same. But this process is time consuming. In order to reduce the time I feel that we can achieve the same using DFSORT. Following is the requirement for the same:

1) Split the file ->I guess we can use STARTREC/ENDREC since this split factor is always consistent

2) Count -> We can achieve using COUNT function in the TRAILER

3) Hash total -> The hash total of a particular numeric field should be printed. We can achieve this using SUM

4) Date -> The current date should be printed.

I am not sure as to how we can get all these together
Example:

Input:
XXXXX 123
XXXAA 345
YYYYY 678
BBBBB 888

If the split factor is 2 then the output should be

Output:

Split1:
=====
07012008
XXXXX 123
XXXAA 345
07012008 2 468


Split2:
=====
07012008
YYYYY 678
BBBBB 888
07012008 2 1566

Where
Header contains only the current date
Trailer contains the current date,space,number of records,hashtotal of the numeric field.
Back to top  
Skolusu



Joined: 07 Dec 2007
Posts: 305
Location: San Jose

Posted: Tue Jul 01, 2008 10:48 pm    Post subject:  

rarvins,

1.What is the criteria for splitting the file?
2. What is the LRECL and RECFM of input and output files
3. What is the position and format of the numeric field to be summed?
Back to top  
rarvins



Joined: 24 Jan 2007
Posts: 46
Location: India

Posted: Wed Jul 02, 2008 12:19 am    Post subject: Reply to: Splitting and merging header trailer using ICETOOL  

Hi Skolusu,

1)The criteria for splitting the files is the number of records. We have a predetermined number. So we can hardcode it directly. Say for example we can take it as 100000

2) The LRECL is 742 and is FB

3) The field that needs to be summed starts @ position 150 and has a PIC S9(7)V99


Thanks
Back to top  
Skolusu



Joined: 07 Dec 2007
Posts: 305
Location: San Jose

Posted: Wed Jul 02, 2008 12:57 am    Post subject: Reply to: Splitting and merging header trailer  

rarvins,

The following JCL will give you the desired results:

Code:
//STEP0100 EXEC PGM=ICEMAN             
//SYSOUT   DD SYSOUT=*                 
//SORTIN   DD DSN=your input 742 LRECL file,
//            DISP=SHR                 
/*
//OUT1     DD DSN=YOUR ouput split file1,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
/*
//OUT2     DD DSN=YOUR ouput split file2,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             

  OUTFIL FNAMES=OUT1,REMOVECC,ENDREC=100000,
  HEADER1=(DATENS=(MD4)),                                     
  TRAILER1=(DATENS=(MD4),X,COUNT,TOT=(150,9,ZD,M10,LENGTH=11))

  OUTFIL FNAMES=OUT2,REMOVECC,STARTREC=100001,                     
  HEADER1=(DATENS=(MD4)),                                     
  TRAILER1=(DATENS=(MD4),X,COUNT,TOT=(150,9,ZD,M10,LENGTH=11))
/*
Back to top  
rarvins



Joined: 24 Jan 2007
Posts: 46
Location: India

Posted: Wed Jul 02, 2008 1:50 am    Post subject: Reply to: Splitting and merging header trailer  

Thanks a lot Skolusu, I changed the datatype of the field that we are trying to do a sum to PD instead of ZD and gave the length as 150,5 instead of 150,9. The job went fine.

Thanks once again for your timely help.

I just have one question

Will the count field and SUM field always start and end @ a particular column or will it vary. Example Will it always start @ 10th position and have a fixed length?
If not can we make it like that so that I can refer to the trailer with a copybook.

Thanks
Back to top  
rarvins



Joined: 24 Jan 2007
Posts: 46
Location: India

Posted: Wed Jul 02, 2008 2:01 am    Post subject:  

Also, is there a way to retain the decimal in the SUM field. In the output file the decimal point is lost

Thanks
Back to top  
Skolusu



Joined: 07 Dec 2007
Posts: 305
Location: San Jose

Posted: Wed Jul 02, 2008 2:56 am    Post subject: Reply to: Splitting and merging header trailer  

Quote: I changed the datatype of the field that we are trying to do a sum to PD instead of ZD and gave the length as 150,5 instead of 150,9. The job went fine.

Go back and read your post and check if you mentioned anything about the summing field being a COMP-3 Field. I just went with your definition.

Quote: Will the count field and SUM field always start and end @ a particular column or will it vary

Yes the count always starts in position 10 on the trailer records for 8 bytes with leading zeroes suppressed

The total value starts from postion 18 for a length of 11 bytes with leading zeroes supressed

If you need the leading zeroes then I can show you a way to do it

Quote:
If not can we make it like that so that I can refer to the trailer with a copybook.

If you want it in a copy book layout , show me the cobol layout and I will show you a way to do it

Quote:
Also, is there a way to retain the decimal in the SUM field. In the output file the decimal point is lost


First and foremost Packed decimal fields do NOT have an implied decimal point. The decimal point depends on how you define the field.

Do you need the total on the trailer record to be in a readable format? if so show me how you want to see it
Back to top  
rarvins



Joined: 24 Jan 2007
Posts: 46
Location: India

Posted: Thu Jul 03, 2008 1:05 am    Post subject:  

Hi Skolusu,

Thanks for your prompt reply. yes I hadnt mentioned about the COMP-3 field. I went through the positions and modified it accordingly to suit the copybook that i have. Also i changed the mask not to supress the leading zeros.

Thanks
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> DFSORT/ICETOOL
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM
Related Links