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

How to implement DO WHILE logic in ICETOOL.


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

New User


Joined: 27 Jul 2007
Posts: 33
Location: mumbai

PostPosted: Mon Jul 18, 2011 10:47 am
Reply with quote

Hi,

Could you please help me in getting the desired output through ICETOOL.

Explanation:
The input has 3 records and for every input record it writes many instances in the output file based on the AMT field which is 70. So in the Do while the loop is performed until AMT field in <= 70. So for the first input record the SAL field is initially 50 and the has to be performed until <= 70(i.e AMT field), so the output has 50, 60 and 65 as it is incremented in the Do while loop by 5 before writing in the output file. Similarly is the case with EMP No is 200 and 300.
for e.g.
DO WHILE (SAL <= AMT)
SAL = SAL + 5;
<WRITE OUTPUT>
END;

The length of each field can be assumed as 10 bytes each. Input files can have RECFM=FB and LRECL=80.

Please refer to the below output structure for more clarity.

Thanks in advance
Code:


Input:
Emp no Name     Place Sal
100    Dexter   Dor   50
200    Hillary  Aus   60
300    Bush     USA   65

Output:
Emp no Name     Place Sal
100    Dexter   DOR   50
100    Dexter   DOR   55
100    Dexter   DOR   60
100    Dexter   DOR   65
100    Dexter   DOR   70
200    Hillary  Aus   60
200    Hillary  Aus   60
200    Hillary  Aus   60
300    Bush     USA   65
300    Bush     USA   70
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Mon Jul 18, 2011 10:53 am
Reply with quote

Hello,
Are the Sal values for the name Hillary correct in the output?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 18, 2011 11:39 am
Reply with quote

You have mistakes in your required output.

Where is AMT coming from?

How much bigger can AMT be than SAL?

Have you tried anything/had any thoughts about how to approach this, youself?

Why do you want to do this?
Back to top
View user's profile Send private message
vaibhavjadhav

New User


Joined: 27 Jul 2007
Posts: 33
Location: mumbai

PostPosted: Mon Jul 18, 2011 2:24 pm
Reply with quote

Please find the below answers for your questions:

yes there was a mistake in the output shown. find the correct version now

Code:

Output:
Emp no Name     Place Sal
100    Dexter   DOR   50
100    Dexter   DOR   55
100    Dexter   DOR   60
100    Dexter   DOR   65
100    Dexter   DOR   70
200    Hillary  Aus   60
200    Hillary  Aus   65
200    Hillary  Aus   70
300    Bush     USA   65
300    Bush     USA   70


you can assume AMT as just the hard coded field in the program.

AMT can be equal to SAL.

i did tried using ICETOOL but i cant find any solution so thought of approaching the forum.

this is one of requirement in the project where i want to convert from PL1 to ICETOOL.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Mon Jul 18, 2011 3:51 pm
Reply with quote

This is not the type of processing that DFSORT/ICETOOL is designed to perform. icon_rolleyes.gif

Garry
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Jul 18, 2011 4:59 pm
Reply with quote

Check if this helps you.. Cheers...
Code:
//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD *                                 
100    DEXTER   DOR   50                         
200    HILLARY  AUS   60                         
300    BUSH     USA   65                         
400    ABCD     LON   00                         
//SORTOUT  DD DSN=&&TEMP,DISP=(NEW,PASS)         
//SYSIN    DD *                                 
  SORT FIELDS=(1,3,CH,A)                         
  OUTFIL REPEAT=15                               
//STEP0200 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD DSN=&&TEMP,DISP=(MOD,PASS)         
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                 
  OPTION COPY                                                     
  INREC IFTHEN=(WHEN=INIT,                                         
          OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,3),INCR=5,START=0)), 
        IFTHEN=(WHEN=NONE,                                         
          OVERLAY=(23:23,2,ZD,ADD,81,8,ZD,ZD,LENGTH=8))           
  OUTFIL OMIT=(23,8,ZD,GT,70),BUILD=(1,80)                         
/*


Output will be
Code:
100    DEXTER   DOR   00000050
100    DEXTER   DOR   00000055
100    DEXTER   DOR   00000060
100    DEXTER   DOR   00000065
100    DEXTER   DOR   00000070
200    HILLARY  AUS   00000060
200    HILLARY  AUS   00000065
200    HILLARY  AUS   00000070
300    BUSH     USA   00000065
300    BUSH     USA   00000070
400    ABCD     LON   00000000
400    ABCD     LON   00000005
400    ABCD     LON   00000010
400    ABCD     LON   00000015
400    ABCD     LON   00000020
400    ABCD     LON   00000025
400    ABCD     LON   00000030
400    ABCD     LON   00000035
400    ABCD     LON   00000040
400    ABCD     LON   00000045
400    ABCD     LON   00000050
400    ABCD     LON   00000055
400    ABCD     LON   00000060
400    ABCD     LON   00000065
400    ABCD     LON   00000070
Back to top
View user's profile Send private message
vaibhavjadhav

New User


Joined: 27 Jul 2007
Posts: 33
Location: mumbai

PostPosted: Mon Jul 18, 2011 5:26 pm
Reply with quote

Thanks for this......i will execute the above code and check if get the desired output.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Jul 18, 2011 6:08 pm
Reply with quote

vaibhavjadhav wrote:
Thanks for this......i will execute the above code and check if get the desired output.

I have shown the output.. Does that look ok for you..?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 19, 2011 2:29 am
Reply with quote

vaibhavjadhav wrote:
[...]this is one of requirement in the project where i want to convert from PL1 to ICETOOL.


Is it a fairly small PL/I program? Otherwise, it sound like a strange idea. Let us know how the conversion goes, I'm always imrpessed by DFSORT/ICETOOL, and it would knock my socks off if you can do it with a non-simple program :-)
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: Tue Jul 19, 2011 3:35 am
Reply with quote

Here's a DFSORT/ICETOOL job that will do it in one pass:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD *
100       DEXTER    DOR       50
200       HILLARY   AUS       60
300       BUSH      USA       65
400       ABCD      LON       00
//OUT DD SYSOUT=*
//TOOLIN DD *
RESIZE FROM(IN) TO(OUT) TOLEN(40) USING(CTL1)
//CTL1CNTL DD *
  INREC BUILD=(1,30,31,2,ZD,ADD,+0,EDIT=(TTT),
   41:1,30,31,2,ZD,ADD,+5,EDIT=(TTT),
   81:1,30,31,2,ZD,ADD,+10,EDIT=(TTT),
   121:1,30,31,2,ZD,ADD,+15,EDIT=(TTT),
   161:1,30,31,2,ZD,ADD,+20,EDIT=(TTT),
   201:1,30,31,2,ZD,ADD,+25,EDIT=(TTT),
   241:1,30,31,2,ZD,ADD,+30,EDIT=(TTT),
   281:1,30,31,2,ZD,ADD,+35,EDIT=(TTT),
   321:1,30,31,2,ZD,ADD,+35,EDIT=(TTT),
   361:1,30,31,2,ZD,ADD,+40,EDIT=(TTT),
   401:1,30,31,2,ZD,ADD,+45,EDIT=(TTT),
   441:1,30,31,2,ZD,ADD,+50,EDIT=(TTT),
   481:1,30,31,2,ZD,ADD,+55,EDIT=(TTT),
   521:1,30,31,2,ZD,ADD,+60,EDIT=(TTT),
   561:1,30,31,2,ZD,ADD,+65,EDIT=(TTT),
   601:1,30,31,2,ZD,ADD,+70,EDIT=(TTT))
  OUTFIL INCLUDE=(31,3,ZD,LE,70),
   BUILD=(1,30,32,2,80:X)
/*
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