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

Using a field of the first record in all the other records


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

New User


Joined: 04 Jan 2007
Posts: 23
Location: Chennai

PostPosted: Mon Jul 23, 2007 12:54 pm
Reply with quote

How to use DFSORT technique for getting a value from the first record of the file in position 10 and of length 8 and use that value in all other records as the prefix. i.e., starting from position 1?
Back to top
View user's profile Send private message
Saradha Ramalingam

New User


Joined: 04 Jan 2007
Posts: 23
Location: Chennai

PostPosted: Mon Jul 23, 2007 6:25 pm
Reply with quote

Hi in my input file the first byte will be the record type.it can be '2' 0r '5'
or '8'. In the record type '2' we will get the values from pos 10 of length 8.
that value will be used in the following record type '5' and '8'. So if i
encounter the record type '2' again in my file the value from pos '10'
will be changed and that should be used in the following records. Can this
be done using SORT other than REXX and COBOL?
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: Mon Jul 23, 2007 8:28 pm
Reply with quote

It's not clear what you want to do. Please show an example of the records in your input file and what you want for output. Give the RECFM and LRECL of your input file. Give the starting position, length and format of all relevant fields.
Back to top
View user's profile Send private message
Saradha Ramalingam

New User


Joined: 04 Jan 2007
Posts: 23
Location: Chennai

PostPosted: Mon Jul 23, 2007 9:14 pm
Reply with quote

The input file record length is 235. The output file lrecl is 253.

Input file is

220070709ABCDEjuk 601.... ------->Batch Header
501O...... -------->detail records
501OReturns....
501OChargeb...
8ABCDEjuk... ---------->Trailer
220070709FGHIJJUR 601....
501O......
501OReturns....
501OChargeb...
8FGHIJJUR...

Output file is

ABCDEjuk0000000000220070709ABCDEjuk 601....
ABCDEjuk0000000001501O......
ABCDEjuk0000000002501OReturns....
ABCDEjuk0000000003501OChargeb...
ABCDEjuk00000000048ABCDEjuk...
FGHIJJUR0001000000220070709FGHIJJUR 601....
FGHIJJUR0001000001501O......
FGHIJJUR0001000002501OReturns....
FGHIJJUR0001000003501OChargeb...
FGHIJJUR00010000048FGHIJJUR...

The first 8 bytes will be the value obtained from the pos 10 of length 8 for the record type '2' and the next 4 bytes will be incremented in the record
type '2' and the next 6 bytes will be incremented for each detail records
and is restarted when a batch is encountered.
Is this information enough?
Can we perform this using SORT?
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: Mon Jul 23, 2007 11:01 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB/235)
//OUT DD DSN=...  output file (FB/253)
//TOOLIN   DD    *
SPLICE FROM(IN) TO(OUT) ON(9,4,ZD) KEEPBASE -
  WITHALL WITH(19,235) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,
          OVERLAY=(19:1,235,9:SEQNUM,4,ZD,START=0)),
        IFTHEN=(WHEN=(19,1,CH,EQ,C'2'),
          OVERLAY=(1:28,8,9:SEQNUM,4,ZD,START=0)),
        IFTHEN=(WHEN=NONE,
          OVERLAY=(254:SEQNUM,4,ZD,
                   9:9,4,ZD,SUB,254,4,ZD,M11,LENGTH=4))
  OUTFIL FNAMES=OUT,
    BUILD=(1,12,
      13:SEQNUM,6,ZD,START=0,RESTART=(1,8),
      19:19,235)
/*
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top