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
 

 

Resequence numbers using DFSORT

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

New User


Joined: 03 Aug 2007
Posts: 19
Location: Naperville

PostPosted: Tue Aug 11, 2009 3:03 am    Post subject: Resequence numbers using DFSORT
Reply with quote

Hi,

I have to insert a new record in given file that is sequenced and bounded by header and trailer. Header record starts with 1 and is also sequenced. Trailer records begins with '9' and is also sequenced . Detail record begins with '2'.Please see below.

10001HEADERFILE
20002aaaaaaaa
20003bbbbbbbb
20004eeeeeeee
90005TRAILER

Another record to be inserted in the above file

ccccccccc

Expected output

10001HEADERFILE
20002aaaaaaaaa
20003bbbbbbbbb
20004cccccccccc <-----record inserted based on location 6,13 ( lenght 7)
20005ddddddddd
90005TRAILER



Let me know if this can be done by using DFSORT?
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 Aug 11, 2009 3:47 am    Post subject:
Reply with quote

It's not clear what you want to do. Your description is confusing.

How are you doing the insert? With a DFSORT job or some other way? Is the input to DFSORT both files (original input and record to be inserted), or one file with the new record already inserted, or what?

If the original sequence number of the trailer was 5 and you add a new data record, it would seem that you would want the trailer record sequence number to be 6, not 5. Do you really want the old sequence number in the trailer and if so, why?

Also, you show 20004eeeeeeee in the input file and 20005ddddddddd in the output file. Is that a typo? Should it really be 20005eeeeeeee in the output file? If not, where did the d record come from?

Please do a better job of explaining what you're trying to do here with a better example of input and expected output. Also, give the RECFM and LRECL of the input file.
Back to top
View user's profile Send private message
avinashgup

New User


Joined: 03 Aug 2007
Posts: 19
Location: Naperville

PostPosted: Tue Aug 11, 2009 4:14 am    Post subject: Reply to: Resequence numbers using DFSORT
Reply with quote

The record format is FB and LRECL=280.

There was a typo in the trailer sequence number should be 900006. The record that is inserted is in a separate file and the 5 records are in a separate file. I want to use the sort to concatenate them and arrange them in sequence.
Back to top
View user's profile Send private message
avinashgup

New User


Joined: 03 Aug 2007
Posts: 19
Location: Naperville

PostPosted: Tue Aug 11, 2009 4:15 am    Post subject:
Reply with quote

Earlier there was a typo in the expected record.

Expected output

10001HEADERFILE
20002aaaaaaaaa
20003bbbbbbbbb
20004cccccccccc <-----record inserted based on location 6,13 ( lenght 7)
20005eeeeeeeee
90005TRAILER
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Aug 11, 2009 12:28 pm    Post subject:
Reply with quote

Avinash Gupta wrote:

Earlier there was a typo in the expected record.

Expected output

10001HEADERFILE
20002aaaaaaaaa
20003bbbbbbbbb
20004cccccccccc <-----record inserted based on location 6,13 ( lenght 7)
20005eeeeeeeee
90005TRAILER


Do you want sequence number in trailer as it is of first input file???
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 Aug 11, 2009 9:33 pm    Post subject:
Reply with quote

Avinash,

I'm still not sure what you want to do since your various statements contradict each other, but I'm going to take a guess that this DFSORT/ICETOOL job will give you what you want:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG   DD  SYSOUT=*
//IN2 DD DSN=...  insert file (FB/280)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
//    DD DSN=...  input file (FB/280)
//OUT DD DSN=...  output file (FB/280)
//TOOLIN   DD    *
COPY FROM(IN2) TO(T1) USING(CTL1)
SORT FROM(CON) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC BUILD=(C'2',6:1,13,280:X)
/*
//CTL2CNTL DD *
  SORT FIELDS=(1,1,CH,A,6,13,CH,A)
  OUTREC OVERLAY=(2:SEQNUM,4,ZD)
/*


If the insert file has:

Code:

ccccccccc   


and the input file has:

Code:

10001HEADERFILE   
20002aaaaaaaa     
20003bbbbbbbb     
20004eeeeeeee     
90005TRAILER     


Then SORTOUT would have:

Code:

10001HEADERFILE     
20002aaaaaaaa       
20003bbbbbbbb       
20004ccccccccc       
20005eeeeeeee       
90006TRAILER         


If that's not what you want then you need to do a better job of explaining what you do want.
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 Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am


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