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

Increment value by one using ICETOOL?


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

New User


Joined: 21 Mar 2007
Posts: 66
Location: Chennai, Tamilnadu, India

PostPosted: Wed Nov 21, 2007 2:29 pm
Reply with quote

Hi All icon_biggrin.gif ,

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
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Wed Nov 21, 2007 2:40 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Nov 21, 2007 10:41 pm
Reply with quote

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
View user's profile Send private message
Ramanan-R

New User


Joined: 21 Mar 2007
Posts: 66
Location: Chennai, Tamilnadu, India

PostPosted: Thu Nov 22, 2007 4:59 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Nov 22, 2007 10:14 pm
Reply with quote

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
View user's profile Send private message
Ramanan-R

New User


Joined: 21 Mar 2007
Posts: 66
Location: Chennai, Tamilnadu, India

PostPosted: Fri Nov 23, 2007 3:35 pm
Reply with quote

Thanks Frank... icon_biggrin.gif
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 Shift left VB record without x00 endi... DFSORT/ICETOOL 11
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
No new posts how to calculate SUM for VB file usin... JCL & VSAM 1
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts ICETOOL to Read records SMF CEF it is... DFSORT/ICETOOL 4
Search our Forums:

Back to Top