Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Updating the count value in trailer record.

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

New User


Joined: 16 Jun 2008
Posts: 40
Location: bangalore

PostPosted: Tue Jun 23, 2009 5:28 pm    Post subject: Updating the count value in trailer record.
Reply with quote

Hi,

We have a requirement as below.

1. We have a input file which looks likw some thing below:

67H_____________ ---> header record
67L_____________ ----> leader redord
67D___________________________________ ----> data record
67D___________________________________ ----> data record
67D___________________________________ ----> data record
.
.
.
67S____XXXXXXX___ --> summary record
67T____YYYYYYYY___ ---> Trailer record

2. Now, we need to take the count of 67D records (data records) and put the count in the summary record in the place of XXXXXXX - 7 bytes in Hexadecimal format.

3. Similarly, we need to take the count of all the record in the file ( basically total data record + 4) and put the count in the Trailer record in the place of YYYYYYY - 7 bytes in Hexadecimal format.

Would you please suggest a solution for this?

I actually found some of the threads similar to this..but I couldn't arrive at a complete solution for this.

Thanks for your time.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


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

PostPosted: Tue Jun 23, 2009 9:17 pm    Post subject:
Reply with quote

Can you delete the old summary and trailer records and build new summary records and trailer records instead of updating the old summary and trailer records? That would be easier.

Do you always have 2 header records?

By 7 bytes hexadecimal do you mean for example X'00000000000123' for a count of 291, or do you mean something else. Please be specific.

What is the RECFM and LRECL of the input file? What is the starting position of the count fields in the summary and trailer records?
Back to top
View user's profile Send private message
ssk1711

New User


Joined: 16 Jun 2008
Posts: 40
Location: bangalore

PostPosted: Wed Jun 24, 2009 10:43 am    Post subject:
Reply with quote

Yeah.. I tried building it instead of updating. I used BUILD option in ICETOOL. But I don't know the correct way to put the COUNT in BUILD funciton. (Pls Advice, whether BUILD is the right one to use here?)

Yes, we always have a Header and a Leader record. (They have two different informations and are consumed by different systems)

Sorry for missing clarity....

Dataset LRECL = 300, FB.

Trailer record lenght:27
Summary record length: 21

In summary and trailer records, the COUNT starts at 10th column and is of length 7. For example,

67SZZZZZZXXXXXXXZZZZZZZZZZZ.
67TAAAAAAYYYYYYYYAAAAAAA.

These Z's and A's values depends on source of the file and other informations. ( we are not afford to loose this info.)

I hope now it should be clear.

Once again thanks for your time.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Jun 24, 2009 8:19 pm    Post subject: Reply to: Updating the count value in trailer record.
Reply with quote

ssk1711,

Use the following DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD DSN=Your 300 byte FB input file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                       
  INREC IFOUTLEN=300,                                     
  IFTHEN=(WHEN=INIT,OVERLAY=(301:SEQNUM,7,ZD)),           
  IFTHEN=(WHEN=(1,3,CH,EQ,C'67S'),                       
  OVERLAY=(10:301,7,ZD,SUB,+3,M11,LENGTH=7)),             
  IFTHEN=(WHEN=(1,3,CH,EQ,C'67T'),OVERLAY=(10:301,7))     
/*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Jun 24, 2009 8:42 pm    Post subject:
Reply with quote

Quote:
Yeah.. I tried building it instead of updating. I used BUILD option in ICETOOL. But I don't know the correct way to put the COUNT in BUILD funciton. (Pls Advice, whether BUILD is the right one to use here?)


No, you would use TRAILER1 to build new trailer records, not BUILD. TRAILER1 has a COUNT parameter. However, if you need to keep the information from the original trailer records, then TRAILER1 won't do that.

Hopefully the job Kolusu supplied does what you want.
Back to top
View user's profile Send private message
ssk1711

New User


Joined: 16 Jun 2008
Posts: 40
Location: bangalore

PostPosted: Thu Jun 25, 2009 6:28 pm    Post subject:
Reply with quote

Thanks a lot!! It solved the issue. Actually I was mulling over EZT program to do the job.

If you are interested (otherwise please ignore reading below!), below is the entire SORT step reqirement in which I have used the above solution.

Please advice, whether the way I have used the ICETOOL is optimal and efficient.

1. Below is the format of the file which is given as input to the SORT step.

67H_____________ ---> header record
67L_____________ ----> leader redord
67D___________________________________ ----> data record
67D___________________________________ ----> data record
67D___________________________________ ----> data record
.
.
.
67S____XXXXXXX___ --> summary record
67L
67D
67D
.
.
67S
..
..
..
67T____YYYYYYYYYY___ ---> Trailer record


As you see, there can be any number of Leader-data-Summary sets with in Header & Trailer records.

2. Details of the input file:

LRECL = 300, FB
Header record length 20
Leader record length 20
Summary record length 27
COUNT : starts at position 10 and of length 7. This count will have the total number of data - 67D records within that Leader - summary record.
Trailer record length 21
COUNT: starts at postion 10 and of length 9 ( this by mistake i have given as 7 last time). This count will have the total number of records in the file (including header, leader, summary, trailer & data)

Both the counts will be of signed decimal i.e. s9(7) and s9(9). ( this I missed to mention last time)

3. Objective of SORT step is to accumulate all the data records (67D) into single set of Leader - Summary records. Other Leader & summary records should be removed. After accumulating data records & removing the leader-summary records, the count in the Summary and trailer records need to be updated accordingly. Also the data fields are need to be sorted based on two fields.

4. My control cards are as below.

i) To accumulate the 67D records and sort them, i have used below control card.

//TOOLIN DD *
DATASORT FROM(INDD) TO(TEMP) HEADER(2) TRAILER(2) USING(CTL1)

//CTL1CNTL DD *
SORT FIELDS(29,09,CH,A,100,01,CH,A)
INCLUDE COND=(01,03,CH,A,C'67D')

ii) To update the count in Summary and trailer records, below are the control cards

//TOOLIN DD*
DATASORT.....
SORT FROM(TEMP) TO(TEMP1) USING(CTL2)
SORT FROM(TEMP1) TO(TEMP2) USING(CTL3)

//CTL2CNTL DD *
SORT FIELDS=COPY
INREC IFOUTLEN=300,
IFTHEN=(WHEN=INIT,OVERLAY=(301:SEQNUM,9,ZD)),
IFTHEN=(WHEN=(1,3,CH,EQ,C'67T'),OVERLAY=(10:301,9))

//CTL3CNTL DD *

SORT FIELDS=COPY
INREC IFOUTLEN=300,
IFTHEN=(WHEN=INIT,OVERLAY=(301:SEQNUM,7,ZD)),
IFTHEN=(WHEN=(1,3,CH,EQ,C'67T'),OVERLAY=(10:301,7))

iii) To conver both the COUNTs from ZD format to ZDC, below is the control card.

//TOOLIN DD *
DATASORT...
SORT...
SORT...
SORT FROM(TEMP2) TO(TEMP3) USING(CTL4)

//CTL4CNTL DD *
OPTION COPY
INREC INOUTLEN=300,
IFTHEN=(WHEN=(01,03,CH,EQ,C'67S'),
OVERLAY=(10:10,7,ZD,TO=ZDC,LENGTH=7)),
IFTHEN=(WHEN=(01,03,CH,EQ,C'67T'),
OVERLAY=(10:10,9,ZD,TO=ZDC,LENGTH=9))


This is how i have used. Would you please let me know is there any way to optimise it?

Once again Thanks a lot!
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Jun 25, 2009 8:56 pm    Post subject:
Reply with quote

SSK1711,

Jeez ! That is one heck of a complicated way to get the desired results. All you want is to eliminate the 67L leader records and sort the 67D data records and update the count at the end. You used 4 passes of the data when you just need 1 pass of data.

Try to tell us what the final requirement is instead of giving bits and pieces of your requirement

Here is a one pass DFSORT/ICETOOL JCL which will give you the desired results

Code:

//STEP0200 EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD DSN=&&T1,DISP=SHR                                     
//OUT      DD SYSOUT=*       
//TOOLIN   DD *                                                     
  DATASORT FROM(IN) TO(OUT) HEADER(2) TRAILER(2) USING(CTL1)         
//CTL1CNTL DD *                                                     
  OMIT COND=(1,3,SS,EQ,C'67L,67S')                                   
  SORT FIELDS=(29,09,CH,A,100,01,CH,A)                               
  OUTFIL FNAMES=OUT,IFOUTLEN=300,                                   
  IFTHEN=(WHEN=INIT,OVERLAY=(301:SEQNUM,9,ZD)),                     
  IFTHEN=(WHEN=(1,3,CH,EQ,C'67S'),                                   
  OVERLAY=(10:303,7,ZD,SUB,+3,ZDC,LENGTH=7)),                       
  IFTHEN=(WHEN=(1,3,CH,EQ,C'67T'),OVERLAY=(10:301,9,ZD,ZDC,LENGTH=9))
/*                                           
Back to top
View user's profile Send private message
ssk1711

New User


Joined: 16 Jun 2008
Posts: 40
Location: bangalore

PostPosted: Fri Jun 26, 2009 10:04 pm    Post subject:
Reply with quote

Thanks a lot!
Back to top
View user's profile Send private message
dwijadas

New User


Joined: 20 Sep 2005
Posts: 14

PostPosted: Wed May 26, 2010 6:15 pm    Post subject:
Reply with quote

Skolusu wrote:
SSK1711,

Jeez ! That is one heck of a complicated way to get the desired results. All you want is to eliminate the 67L leader records and sort the 67D data records and update the count at the end. You used 4 passes of the data when you just need 1 pass of data.

Try to tell us what the final requirement is instead of giving bits and pieces of your requirement

Here is a one pass DFSORT/ICETOOL JCL which will give you the desired results

Code:

//STEP0200 EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD DSN=&&T1,DISP=SHR                                     
//OUT      DD SYSOUT=*       
//TOOLIN   DD *                                                     
  DATASORT FROM(IN) TO(OUT) HEADER(2) TRAILER(2) USING(CTL1)         
//CTL1CNTL DD *                                                     
  OMIT COND=(1,3,SS,EQ,C'67L,67S')                                   
  SORT FIELDS=(29,09,CH,A,100,01,CH,A)                               
  OUTFIL FNAMES=OUT,IFOUTLEN=300,                                   
  IFTHEN=(WHEN=INIT,OVERLAY=(301:SEQNUM,9,ZD)),                     
  IFTHEN=(WHEN=(1,3,CH,EQ,C'67S'),                                   
  OVERLAY=(10:303,7,ZD,SUB,+3,ZDC,LENGTH=7)),                       
  IFTHEN=(WHEN=(1,3,CH,EQ,C'67T'),OVERLAY=(10:301,9,ZD,ZDC,LENGTH=9))
/*                                           


thanks for such simple example .. i am not able to understand where is the count is being generated ?

I got one header and trailer record. not able to customize this according to my requirement.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu May 27, 2010 10:22 pm    Post subject:
Reply with quote

dwijadas wrote:
thanks for such simple example .. i am not able to understand where is the count is being generated ?

I got one header and trailer record. not able to customize this according to my requirement.


dwijadas,

The count is being generated using IFTHEN statement and seqnum.

Show me your input and desired output along with the DCB properties and I will show you a way to do it
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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us