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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Using a field of the first record in all the other records
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    Post subject:
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 Moderator


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

PostPosted: Mon Jul 23, 2007 8:28 pm    Post subject:
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    Post subject: Re: Using a field of the first record in all the other recor
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 Moderator


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

PostPosted: Mon Jul 23, 2007 11:01 pm    Post subject:
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    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 Record Not found in AlX but record re... mukun264 COBOL Programming 7 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am


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