|
View previous topic :: View next topic
|
| Author |
Message |
scorp_rahul23
New User

Joined: 06 May 2008 Posts: 96 Location: Delhi
|
|
|
|
Hi,
I am trying to work on a scenario where i need to update the last record in the file.
Input file if of 32500 Reclength.
File Data looks like this.
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
12123
000000000000FFFFF4444444444444444444444444444444444444444444444444444444
000000000000121230000000000000000000000000000000000000000000000000000000
-----------------------------------------------------------------------
PAYM O¶ ¾ `T715014 ð 1715014 S1894628
DCED00DB0001B002007EFFFFFF01014400080000000044444444FFFFFFF00101EFFFFFFF
71840166000F9C2202937150140A0A0000AC0000000000000000171501400A0A21894628
-----------------------------------------------------------------------
â qo" q ¤
FFFF00430997009394444444444444444444444444444444444444444444444444444444
FFFF0F2F086F0088F0000000000000000000000000000000000000000000000000000000
|
In this I want to update the last record . Value to be replaced are
| Code: |
--+--
*****
- -
q ¤
00939
0088F
|
Starting position will be 13 and I I need to update it like.
| Code: |
--+--
*****
- -
q ¤
00001
0000F
|
I am not able to do it. Can please suggest some idea on this.
Thanks |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Will the last record always have x'FFFFFFFF' in the first 4 bytes?
Will the last record be the only record that can have x'FFFFFFFF' in the first 4 bytes?
Will the replacement value always be the same?
Is there some reason this packed-decimal field contains the F-sign rather than the more typical C-sign? |
|
| Back to top |
|
 |
scorp_rahul23
New User

Joined: 06 May 2008 Posts: 96 Location: Delhi
|
|
|
|
Hi Dick,
Thanks for the quick response
| Quote: |
Will the last record always have x'FFFFFFFF' in the first 4 bytes?
|
Yes
| Quote: |
Will the replacement value always be the same?
|
Yes
| Quote: |
Is there some reason this packed-decimal field contains the F-sign rather than the more typical C-sign?
|
Not sure but it will be like this only. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
scorp_rahul23,
Assuming that ONLY the last record has X'FFFFFFFF' in the first 4 bytes the following DFSORT JCL will give you the desired results.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=your input 32500 FB file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(1,4,CH,EQ,X'FFFFFFFF'),
OVERLAY=(13:+1,TO=PDF,LENGTH=5))
//* |
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job that will do what you asked for:
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(1,4,BI,EQ,X'FFFFFFFF'),
OVERLAY=(13:X'000000001F'))
/*
|
|
|
| Back to top |
|
 |
scorp_rahul23
New User

Joined: 06 May 2008 Posts: 96 Location: Delhi
|
|
|
|
Thanks a lot Frank and Skolusu.
Both approach worked ....  |
|
| Back to top |
|
 |
|
|