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

Utility that increments a number in the first record only?


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

New User


Joined: 28 Sep 2005
Posts: 55
Location: USA

PostPosted: Wed Oct 04, 2006 3:59 am
Reply with quote

Hi all,
I'm wondering if any of you know of a utility that can do the following....without spending very much time on this....
1) file is 400 bytes.
2) the 1st record is a "rollyear" record and only contains data in bytes 14-20 something like 2005000 and the rest of the record contains packed 0 or spaces. It is the same format as the rest of the records
3) all other records contain data in the fields,...not 0.
4) Without doing it manually, can the that 1st record be updated to Add 1 to the year in bytes 14-17 and write out all other records as is? So, for this sample file the new output would be 2006000 in bytes 14-20.

If you know of an "easy" way, without writing a program or without "hard coding" the value, please let me know.

Thank-you,
Back to top
View user's profile Send private message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 55
Location: USA

PostPosted: Wed Oct 04, 2006 4:08 am
Reply with quote

I forgot to post a sample of the file data. Here it is:

.............2005000 .........................................................
0000000000000FFFFFFF444000000000000000000000000000000000000000000000000000000000
00000C000C00C2005000000000000C000000C000000C000000C000000C000000C000000C000000C0
------------------------------------------------------------------------------
.. .........%2005000 ....................*......*.............................
0040032000006FFFFFFF444000000000000000000505000050500000000000000000000000000000
20010C051C01C2005000000000000C000000C000180C000180C000000C000000C000000C000000C0
------------------------------------------------------------------------------
.. .........%2005000 ....................%......%.............................
0040082000006FFFFFFF444000000000000000000416000041600000000000000000000000000000
20012C051C01C2005000000000000C000000C000255C000255C000000C000000C000000C000000C0
------------------------------------------------------------------------------
.. .........%2005001 ....................)......@.............................
0040082000006FFFFFFF444000000000000000000065000006700000000000000000000000000000
20012C041C01C2005001000000000C000000C000005D000093C000000C000000C000000C000000C0
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: Wed Oct 04, 2006 4:26 am
Reply with quote

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

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/400)
//SORTOUT DD DSN=...  output file (FB/400)
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=400,
        IFTHEN=(WHEN=INIT,OVERLAY=(401:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(401,8,ZD,EQ,+1),
          OVERLAY=(14:14,4,ZD,ADD,+1,TO=ZD,LENGTH=4))
/*
Back to top
View user's profile Send private message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 55
Location: USA

PostPosted: Wed Oct 04, 2006 4:46 am
Reply with quote

Frank,
That really works great!
Thanks!
Sysaron
Back to top
View user's profile Send private message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 55
Location: USA

PostPosted: Wed Oct 04, 2006 6:11 am
Reply with quote

Frank,

I understand most of the input statements, but why use 401 in these two areas please?
IFTHEN=(WHEN=INIT,OVERLAY=(401:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(401,8,ZD,EQ,+1),

Sysaron
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: Wed Oct 04, 2006 8:22 pm
Reply with quote

You said "file is 400 bytes". Since we only need the sequence number temporarily to check for record number 1, we put it at the end of the record (positions 401-408) and remove it (with IFOUTLEN=400) when we're done with it.
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 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
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
Search our Forums:

Back to Top