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
 

 

Increment value by one using ICETOOL?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Increment value by one using ICETOOL?
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: 1439
Location: Bangalore,India

PostPosted: Wed Nov 21, 2007 2:40 pm    Post subject:
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 Moderator


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

PostPosted: Wed Nov 21, 2007 10:41 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Nov 22, 2007 10:14 pm    Post subject:
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    Post subject:
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    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 Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Group elements using ICETOOL Learncoholic DFSORT/ICETOOL 2 Fri Apr 14, 2017 11:01 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts ICETOOL/SYNCSORT - SYSPRINT output nartcr DFSORT/ICETOOL 17 Wed Oct 05, 2016 10:46 pm


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