Count update for group trailer



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Count update for group trailer

Postby rupsom » Fri Oct 04, 2013 7:38 pm

Hi Team,

Seek your advise for the below request .. I have a file that I have reformatted and now I need to update the counts of group trailer and two end trailer records . Using the IFTRAIL command I am able to update only the last trailer record . Hence I am stuck with other ones . Please advise for Req#1 and Req#2..

Here's the sample file :
Req#1. 03-49 is one group and I want to update the count in the group trailer i.e 49 .. have highlighted in Red color.
Req#2. 98 is first trailer record for entire file and I need to update two count position . Marked in Orange is the total count for number of '03' key records. Marked in Blue is the total count of records - 2
req#3. 99 is the final trailer record and I need to update one count postition - This i have achieved using IFTRAIL command.

01,0001,11111,130603,0529,001,80,1,2/
02,11111,22222222,1,130531,,/
03,11111111111,,010,+0068068313820,,,015,+0062823920185,,/
88,100,000001345118504,00003,V,130531,,400,000003109149641,00002,V,130531,/
16,698,0000000046000,V,130531,,,, /
49,+00000139800770295,000000004/
03,22222222222,010,+0001045747605,,,015,+0000388918843,,/
88,100,000000000043760,00001,V,130531,,400,000000656872522,00002,V,130531,/
16,108,00000000437,V,130531,,,, /
16,409,00001787677,V,130531,,,, /
16,409,0000478104,V,130531,,,, /
49,+0000000274849,000000006/
03,33333333333,010,+0000000000000,,,015,+0000000000000,,/
88,100,00000134108,00069,V,130531,,400,000001341089154,00002,V,130531,/
16,108,0000004100,V,130530,,,, /
16,409,0000004100,V,130530,,,, /
16,108,0000026727,V,130531,,,, /
16,108,0000028230,V,130531,,,, /
16,108,00000377,V,130531,,,, /
16,506,0001336749,V,130531,,,, /
16,185,0000099544,V,130531,,,, /
49,+0000000536416,000000010/
03,44444444444,010,+0000000000000,,,015,-0000001531989,,/
88,100,00000003750,00001,V,130531,,400,000000005625739,00006,V,130531,/
16,108,000000750,V,130531,,,, /
16,409,00000004400,V,130531,,,, /
16,506,0000009350,V,130531,,,, /
16,409,00000000300,V,130531,,,, /
16,409,00000018290,V,130531,,,, /
16,409,00000001518,V,130531,,,, /
16,409,00000000881,V,130531,,,, /
49,+000000000176989,000000010/
98,+000001479408510,000000004,000000033/
99,+000001479408510,000000001,000000034/

Please let me know if any doubts.
Thanks & Regards
Rupa
rupsom
 
Posts: 5
Joined: Fri Oct 04, 2013 5:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: Count update for group trailer

 

Re: Count update for group trailer

Postby BillyBoyo » Fri Oct 04, 2013 10:19 pm

What is your RECFM and LRECL? Are all the fields per record-type in fixed positions, or do those commas indicate a "delimited" file?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Count update for group trailer

Postby rupsom » Fri Oct 04, 2013 10:34 pm

Hi Billy,

Sorry I missed to mention that .. Record length is 80 bytes - Fixed, and all fields are in fixed position .
For eg :
For Record Type 49, where I need to update the count position for group records 03-49 ,, the "count field" is in position 23rd having length 9.
For Record Type 98 where I need to update the count positions , "count field 1" is in postion 23rd and "count field 2" is in position 33 , both having lenth 9.

Any advise is appreciated.

Thanks so much
rupsom
 
Posts: 5
Joined: Fri Oct 04, 2013 5:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: Count update for group trailer

Postby rupsom » Sun Oct 06, 2013 12:38 am

Hi All,

I have found solution to all the Requirements except Marked in Orange , the total count for number of '03' key records.. Do anyone have any suggestion how this can be achieved using DFSORT?

Thanks & Regards
Rupa
rupsom
 
Posts: 5
Joined: Fri Oct 04, 2013 5:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: Count update for group trailer

Postby BillyBoyo » Sun Oct 06, 2013 4:47 am

You are doing well. Can you show the code you have? Then we can suggest something which fits in with what you have.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Count update for group trailer

Postby rupsom » Wed Oct 09, 2013 12:30 am

Hi Billy

I was finally able to get a solution .. I have used the following logic.. Sharing the code for everyone's benefit .. Please let me know if it could have been done in a better way . Thanks!

Req#1. 03-49 is one group and I want to update the count in the group trailer i.e 49 .. have highlighted in Red color.

Solution : This will sequence the records in the group 03-49 and at the end of the group ie record "49" I can get the final count..
OPTION COPY                                           
INREC  IFTHEN=(WHEN=GROUP,                           
       BEGIN=(1,2,CH,EQ,C'03'),END=(1,2,CH,EQ,C'49'),
       PUSH=(102:SEQ=9))                             
OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'49'),               
       OVERLAY=(23:102,9))

Req#2. 98 is first trailer record for entire file and I need to update two count position . Marked in Orange is the total count for number of '03' key records. Marked in Blue is the total count of records - 2.
Plus : 99 is the final trailer record and I need to update one count postition

Solution:Update count for "03"

 OPTION COPY                                               
 INCLUDE COND=(1,2,SS,EQ,C'BI,01,02,03,88,16,49,98,99')     
  INREC  IFTHEN=(WHEN=(1,2,CH,EQ,C'03',OR,1,2,CH,EQ,C'98'),
          OVERLAY=(111:SEQNUM,9,ZD))                       
  OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'98'),                   
          OVERLAY=(23:111,9,ZD,SUB,+1,TO=ZD,LENGTH=9))


Update total count for "98" and "99"

Solution:
 SORT FIELDS=COPY                                           
  INCLUDE COND=(1,2,SS,EQ,C'BI,01,02,03,88,16,49,98,99')   
  OUTREC IFOUTLEN=105,                                     
    IFTHEN=(WHEN=INIT,OVERLAY=(93:SEQNUM,9,ZD)),           
    IFTHEN=(WHEN=(1,2,CH,EQ,C'98'),                         
      OVERLAY=(33:93,9,ZD,SUB,+2,TO=ZD,LENGTH=9)),         
    IFTHEN=(WHEN=(1,2,CH,EQ,C'99'),                         
      OVERLAY=(33:93,9,ZD,SUB,+1,TO=ZD,LENGTH=9))


Thanks & Regards
Rupa

Code'd
rupsom
 
Posts: 5
Joined: Fri Oct 04, 2013 5:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: Count update for group trailer

Postby BillyBoyo » Thu Oct 10, 2013 1:35 am

OK. What you need now is to get all that into one set of Control Cards. Now you have the pieces working, I can't see anything to prevent consolidation. Have more than one place for the counts, just to keep it clearer for yourself. IFOUTLEN is a good way to cut down the records to original size.

Congratulations. Mostly people just post here and wait for answers. You've done the work yourself.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Count update for group trailer

Postby rupsom » Thu Oct 10, 2013 2:31 am

Thanks Billy ,, will do :)
rupsom
 
Posts: 5
Joined: Fri Oct 04, 2013 5:27 am
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post