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

Help needed on Reformat and print trailer if account changes


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

New User


Joined: 18 Dec 2007
Posts: 51
Location: delaware

PostPosted: Tue Aug 11, 2009 12:15 am
Reply with quote

Code:

38762916000001055760006363072080629                              VWELLS
38762916000000050000006389382080630                              VOBAMA
38762916000000001000006394653080630                              VAHARON
38762916000000050000006394917080630                              VCHICAG
T037593192340000097359                                                 
38762924000001365000310355451090702                              VMONTAL
38762924000001010000310519488090420                              VUSCIS
38762924000000000340310524331090428                              VNaeila
38762924000005131190310573202090513                              VKIM KA


Hi all,

I have an input file of 80 bytes, with some 10 different accounts, all appearing in 1st position. The requirement is, to reformat (different layout provided by the customer) based on account and also print a trailer once the account changes. The situation here is,the trailer in input file is different from output file. In the output file , I should move the whole record by 2 bytes.

Is this possible to reformat the detail records based on the account and also print the trailer when the Account number changes ?

Please do excuse me if any of my statements are not clear. I will try to provide more if required. Thanks for your help in advance.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Aug 11, 2009 12:22 am
Reply with quote

Hello,

It will help if you post the output you want from that input. . .
Back to top
View user's profile Send private message
kirankumarj

New User


Joined: 18 Dec 2007
Posts: 51
Location: delaware

PostPosted: Tue Aug 11, 2009 12:45 am
Reply with quote

Code:

38762916000001055760006363072080629              V
38762916000000001000006394653080630              V
38762916000000050000006394917080630              V
  T037593192340000000004
38762924000001365000310355451090702 V 
38762924000001010000310519488090420 V
38762924000000000340310524331090428 V
38762924000005131190310573202090513 V
  T001572879320000000105


Esentially, what needs to be done is (i have given only 2 accts here,there are 10 in total), the position of V changes for detail records. For the 2 mentioned accounts, for one it appears at 65 pos and for the 2nd it appears on 45 position.

But the trailer is in the same position, 3. It gives the amount and count.
Back to top
View user's profile Send private message
kirankumarj

New User


Joined: 18 Dec 2007
Posts: 51
Location: delaware

PostPosted: Tue Aug 11, 2009 12:56 am
Reply with quote

There are spaces after the data and Void indicator. I am not able to show the spaces in the above example. It is taking away my format example.
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: Tue Aug 11, 2009 1:09 am
Reply with quote

You can certainly use IFTHEN clauses to build the records differently for the different accounts.

Quote:
There are spaces after the data and Void indicator. I am not able to show the spaces in the above example. It is taking away my format example.


I added ubb code tags to show the correct layout - you can use them too.

But it's difficult to understand what you want to do because you don't really explain what you want for the trailer. For the input, you only show one T record, but for the output you show two T records. Are the T records actually in the input file? Do the Trailer records just have to be moved over 2 for the output file, or do they have to be changed in some way (how)?

Code:

  T037593192340000000004


How does this trailer record correspond to your statement that
Quote:
But the trailer is in the same position, 3. It gives the amount and count.


Where is the amount - how is it calculated?

Where is the count - how is it calculated (is it the count of details records + 1 for the trailer record, or something else?).

Are the trailer records present in the input file file and just copied to the output file moved over by 2 positions, or does a new trailer record have to be built or the old one overlayed in some way?
Back to top
View user's profile Send private message
kirankumarj

New User


Joined: 18 Dec 2007
Posts: 51
Location: delaware

PostPosted: Tue Aug 11, 2009 1:17 am
Reply with quote

Frank,

In the input file also,there is one trailer for each account.

In the input file, the record starts in position 1 , with an indicator "T" and followed by 11 bytes for amount and 10 bytes for count.

In the output file, the Indicator should appear in position 10. The amount should appear in position 25 for 11 and the count should appear in position 10 for 10.
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: Tue Aug 11, 2009 1:47 am
Reply with quote

You can use a DFSORT job like the following to do what you asked for. Your starting positions are not accurate, so adjust the starting positions as needed (e.g. it makes no sense to say the indicator should be in position 10 in the output and the count should appear in position 10 in the output, so I started the count in position 11 - adjust as needed).

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
38762916000001055760006363072080629                              VWELLS
38762916000000050000006389382080630                              VOBAMA
38762916000000001000006394653080630                              VAHARON
38762916000000050000006394917080630                              VCHICAG
T037593192340000097359
38762924000001365000310355451090702                              VMONTAL
38762924000001010000310519488090420                              VUSCIS
38762924000000000340310524331090428                              VNAEILA
38762924000005131190310573202090513                              VKIM KA
T037593192340000097359
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,8,CH,EQ,C'38762916'),
    BUILD=(1,35,65:66,1)),
   IFTHEN=(WHEN=(1,8,CH,EQ,C'38762924'),
    BUILD=(1,35,45:66,1)),
   IFTHEN=(WHEN=(1,1,CH,EQ,C'T'),
    BUILD=(10:1,1,11:13,10,25:2,11))
/*
Back to top
View user's profile Send private message
kirankumarj

New User


Joined: 18 Dec 2007
Posts: 51
Location: delaware

PostPosted: Tue Aug 11, 2009 6:00 pm
Reply with quote

But how do I add trailer record, specific to the account ? Can that be accomodated inside the BUILD ?

Thanks once again for taking time to respond.
Back to top
View user's profile Send private message
kirankumarj

New User


Joined: 18 Dec 2007
Posts: 51
Location: delaware

PostPosted: Tue Aug 11, 2009 7:02 pm
Reply with quote

I didnt read closely. I do see you have a code for Trailer. That should work. Let me test and let you know. Thanks Frank.
Back to top
View user's profile Send private message
kirankumarj

New User


Joined: 18 Dec 2007
Posts: 51
Location: delaware

PostPosted: Tue Aug 11, 2009 7:13 pm
Reply with quote

Thank you Frank.
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 JCL sortcard to print only the records DFSORT/ICETOOL 11
No new posts Mainframe Programmer with CICS Skill... Mainframe Jobs 0
No new posts How to Reformat a file using File Man... All Other Mainframe Topics 14
No new posts Insert trailer for non empty file only DFSORT/ICETOOL 6
No new posts Reformat and relocate content DFSORT/ICETOOL 4
Search our Forums:

Back to Top