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

Resequence numbers using DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Tue Aug 11, 2009 3:47 am
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
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
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
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 Developer


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

PostPosted: Tue Aug 11, 2009 9:33 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top