View previous topic :: View next topic
Author
Message
Ramanan-R New User Joined: 21 Mar 2007Posts: 66 Location: Chennai, Tamilnadu, India
Hi All ,
I have an Input file with LRECL 100. It has values of COBOL data type S9(3) COMP-3 format at columns 59 and 74 respectively.
The requirement is
1. To add 1 to the existing value. E.g if the existing value is 4 then, it should be overlayed with value 5.
2. If the existing value is greater than 5, then it should be overlayed with value 1.
Can we achieve this using ICETOOL?
Thanks in advance,
Ramanan R
Back to top
murmohk1 Senior Member Joined: 29 Jun 2006Posts: 1436 Location: Bangalore,India
Ramanan,
May be you are looking for this -
Code:
//STEP1 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1
2
3
4
5
6
7
8
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(1,1,ZD,LE,+5),
OVERLAY=(1,1,ZD,ADD,+1,EDIT=(T))),
IFTHEN=(WHEN=(1,1,ZD,GT,+5),
OVERLAY=(1:C'1'))
/*
o/p:
Code:
**
2
3
4
5
6
1
1
1
**
Change sortcard as per your requirement.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Ramanan R,
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/100)
//OUT DD DSN=... output file (FB/100)
//TOOLIN DD *
COPY FROM(IN) TO(OUT) USING(CTL1)
/*
//CTL1CNTL DD *
INREC IFOUTLEN=100,
IFTHEN=(WHEN=INIT,
OVERLAY=(101:59,2,103:74,2)),
IFTHEN=(WHEN=(101,2,PD,GT,+5),
OVERLAY=(59:+1,TO=PD,LENGTH=2),HIT=NEXT),
IFTHEN=(WHEN=(101,2,PD,LE,+5),
OVERLAY=(59:101,2,PD,ADD,+1,TO=PD,LENGTH=2),HIT=NEXT),
IFTHEN=(WHEN=(103,2,PD,GT,+5),
OVERLAY=(74:+1,TO=PD,LENGTH=2),HIT=NEXT),
IFTHEN=(WHEN=(103,2,PD,LE,+5),
OVERLAY=(74:103,2,PD,ADD,+1,TO=PD,LENGTH=2))
/*
Back to top
Ramanan-R New User Joined: 21 Mar 2007Posts: 66 Location: Chennai, Tamilnadu, India
Murali & Frank,
Thanks for the code, There is a small change in the requirement. Its Point#-1 alone.
Quote:
The requirement is
1. To add 1 to the existing value. E.g if the existing value is 4 then, it should be overlayed with value 5.
Thanks & Regards,
Ramanan R
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
That's not a "small change" - it's a completely different requirement and a lot simpler. If you just want to add 1 to the 2-byte PD values at positions 59-60 and 74-75, you can use this DFSORT job:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/100)
//OUT DD DSN=... output file (FB/100)
//TOOLIN DD *
COPY FROM(IN) TO(OUT) USING(CTL1)
/*
//CTL1CNTL DD *
INREC OVERLAY=(59:59,2,PD,ADD,+1,TO=PD,LENGTH=2,
74:74,2,PD,ADD,+1,TO=PD,LENGTH=2)
/*
Back to top
Ramanan-R New User Joined: 21 Mar 2007Posts: 66 Location: Chennai, Tamilnadu, India
Thanks Frank...
Back to top
Please enable JavaScript!