Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Splitting and merging header trailer

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
rarvins

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

PostPosted: Tue Jul 01, 2008 7:59 pm    Post subject: Splitting and merging header trailer
Reply with quote

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
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Tue Jul 01, 2008 10:48 pm    Post subject:
Reply with quote

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
View user's profile Send private message
rarvins

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

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

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
View user's profile Send private message
Skolusu

Senior Member


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

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

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
View user's profile Send private message
rarvins

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

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

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
View user's profile Send private message
rarvins

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

PostPosted: Wed Jul 02, 2008 2:01 am    Post subject:
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


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

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

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
View user's profile Send private message
rarvins

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

PostPosted: Thu Jul 03, 2008 1:05 am    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Splitting of single report to seperat... abdulrafi TSO/ISPF 4 Mon Mar 27, 2017 3:59 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Query on Splitting up a file abdulrafi COBOL Programming 19 Wed Apr 20, 2016 3:26 pm
No new posts DSN name in trailer kranthikumarb DFSORT/ICETOOL 7 Mon Feb 29, 2016 11:30 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us