Unable to achieve below scenario using ICETOOL

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

sirianangel
Member
Posts: 12
Joined: Sun Aug 22, 2010 1:57 am

Unable to achieve below scenario using ICETOOL

Post by sirianangel » Sun Aug 22, 2010 4:28 am

Hi,

I have been reviewing this website since an year for some of the issues i faced while using SORT.

Frank, I really appreciate your techinical knowledge and the way you help people with great patience. Today, i have joined this site, seeing your responses.

I have below issue. It would be great if you can help me solve this problem as early as possiable.

Requirement:

Sample Input file:
1111
1111
1111
1114
2222
2222
2224
3333 10.00
3333 10.00
3333 10.00
4444

Position 1,4 -> Represents key data
Position 6,8-> Represents amount which will be present only on key data = 3333

Exepcted Output file->
HEADER 1111 3 2222 2 3333 30.00
1111
1111
1111
1114
2222
2222
2224
3333 10.00
3333 10.00
3333 10.00
4444

Basically here, if you see in the output file, I need a HEADER record with Key data 1111 & 2222 and the number of times it occured in the input file.
And for the Key data 3333, since it holds amount, I need the total amount for this Key.

I am unable to achieve this using ICETOOL. Could you please help.

Thanks,
Siri

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Mon Aug 23, 2010 10:20 pm

Thanks for the kind words.

What is the RECFM and LRECL of the input file? What do you want for the RECFM and LRECL of the output file?

What do you want for the layout of the HEADER record - do you really want only 1 digit for each count, and dd.dd for the amount, or do you want something else - what? Please be specific.

Does the amount look like this in 6,8 (b for blank):

bbb10.00

or like this:

10.00bbb

or what?

It would help if you used ubb code tags.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

sirianangel
Member
Posts: 12
Joined: Sun Aug 22, 2010 1:57 am

Post by sirianangel » Tue Aug 24, 2010 12:53 am

Hi Frank,

Sorry for the confusion caused related to sample data representation.

Please find the details requested.

Input and Output file RECFM is FB and LRECL is 100.

I have not placed the complete layout on how actual data would look like since there are many character/ numeric fields and these fields are not required to be considered for building the Header record.

However, Please do find the layouts which may be usefull for the scenerio.

Sample Input layout:
Key data - X(4)
FILLER - length 1
AMOUNT - 9(2)v99
FILLER - length 94

Expected output layout

Same as Input with Header record.

Header record layout:

Label Header - x(6)
FILLER - length 1
Key data 1 - X(4)
COUNT - 9(2)
Key data 2 - X(4)
COUNT - 9(2)
Key data 3 - X(4)
COUNT - 9(4)V99
Remaining fillers

Please find the reformatted input data as per the layout.
Input Data:
1111 0
1111 0
1111 0
1114 0
2222 0
2222 0
2224 0
3333 10.00
3333 10.00
3333 10.00
4444 0

Thanks,
Siri

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Aug 24, 2010 1:19 am

Sorry, but that doesn't really help (and seems inconsistent). Can you please show the layouts like this:

Code: Select all

Input record:

Positions 1-4 - key
Positions 5-5 - blank 
Positions 6-?  - ZD amount
...

Header record:

Positions 1-6 - 'HEADER'
Positions 7-7 - blank
...
Sorry to be picky but I don't want to give you a job and then have you come back and say "but what I really wanted was ...".
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

sirianangel
Member
Posts: 12
Joined: Sun Aug 22, 2010 1:57 am

Post by sirianangel » Tue Aug 24, 2010 7:10 am

Hi,

Please find the requested details:
Input record:

Positions 1-4 - Key
Positions 5-5 - blank
positions 6-8 - PD AMOUNT

Output record

Header record:
Position 1-6 - 'HEADER'
Position 7-7 - blank
Position 8-10 - Key data 1 i.e. 1111
Position 11-12- Count (cHARACTER)
Position 13-13- blank
Position 14-16- Key data 2 i.e. 2222
Position 17-18- Count (cHARACTER)
Position 19-19- blank
Position 20-22- Key data 3 i.e. 3333
Position 23-26- Sum amount
Position 26-x - blanks

After writing the above header record, same input data should be written to output.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Aug 25, 2010 1:02 am

Still doesn't add up. You show the input key as X(4) and '1111', but then in your output layout you have position 8-10 - key data 1, i.e. 1111. 1111 is four characters, so how can it fit in 3 positions (8-10)?

You need to resolve the inconsistencies.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

sirianangel
Member
Posts: 12
Joined: Sun Aug 22, 2010 1:57 am

Post by sirianangel » Wed Aug 25, 2010 5:25 am

Sorry frank for the confusion. Please find the modified output layout of Header record.

Position 1-6 - 'HEADER'
Position 7-7 - blank
Position 8-12 - Key data 1 i.e. 1111
Position 13-14- Count (cHARACTER)
Position 15-15- blank
Position 16-20- Key data 2 i.e. 2222
Position 21-22- Count (cHARACTER)
Position 23-23- blank
Position 24-28- Key data 3 i.e. 3333
Position 29-32- Sum amount
Position 32-x - blanks

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Aug 25, 2010 10:01 pm

Here's a DFSORT/ICETOOL job that will do what you asked for. Be sure to use a MOD (or SYSOUT) data set for //OUT.

Code: Select all

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file (FB/100)
//*** Use MOD data set for OUT
//OUT DD DISP=(MOD,CATLG,DELETE,DSN=...  MOD output file (FB/100)
//TOOLIN DD *
COPY FROM(IN) TO(OUT) USING(CTL1)
COPY FROM(IN) TO(OUT)
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,
     OVERLAY=(101:C'0',102:C'0',103:X'00000C')),
    IFTHEN=(WHEN=(1,4,CH,EQ,C'1111'),OVERLAY=(101:C'1')),
    IFTHEN=(WHEN=(1,4,CH,EQ,C'2222'),OVERLAY=(102:C'1')),
    IFTHEN=(WHEN=(1,4,CH,EQ,C'3333'),OVERLAY=(103:6,3))
  OUTFIL REMOVECC,NODETAIL,
    TRAILER1=('HEADER',
     8:'1111',13:TOT=(101,1,ZD,EDIT=(IT)),
    16:'2222',21:TOT=(102,1,ZD,EDIT=(IT)),
    24:'3333',29:TOT=(103,3,PD,TO=PD,LENGTH=4)),
    BUILD=(1,100)
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

sirianangel
Member
Posts: 12
Joined: Sun Aug 22, 2010 1:57 am

Post by sirianangel » Wed Sep 08, 2010 5:44 am

Hi Frank,

Thanks for the solution provided. But the Header record is written in the bottom of the file.

Could you please provide the modified ICETOOL step which writes the HEADER record on top of the file as explained in my earlier example.

Exepcted Output file->
HEADER 1111 3 2222 2 3333 30.00
1111
1111
1111
1114
2222
2222
2224
3333 10.00
3333 10.00
3333 10.00
4444

Thanks,
Siri

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Sep 08, 2010 9:50 pm

Siri,

When I run my job, the header appears as the first record as requested, not the last record.

So you must have changed the job in some way (it isn't obvious to me what you did to get the header at the bottom). Show the complete JCL and control statements YOU used.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

sirianangel
Member
Posts: 12
Joined: Sun Aug 22, 2010 1:57 am

Post by sirianangel » Thu Sep 09, 2010 7:20 am

Hi Frank,
You are right! I forget to use the second copy step in TOOLIN..I got the expected result for the scenario mentioned.

I have another issue related to similar scenario and need your insight..

Input layout:
Header layout-
position 1,8(CH) - 'HEADER '
position 9,4(CH) - '1111'
position 13,4(9(4)) - count (As per the sample data, i am assuming this could be represented by UFF)
position 17,4(CH) - '2222'
position 21,4,(9(4)) - count (As per the sample data, i am assuming this could be represented by UFF)
position 25,4(CH) - '3333'
position 29,10(-9(6).99)) - sum amount (As per the sample data, i am assuming this could be represented by SFF)

Detail record layout-
position 1,4(CH) - key data
position 5,10(-9(6).99)) - amount

Sample Input data-
HEADER 11110003222200023333 000030.00
1111
1111
1111
1114
2222
2222
2224
3333 000010.00
3333 000010.00
3333 000010.00
4444

Expected output:
Execute ICETOOL on the input data and balance. If INPUT data is not balanced, set return code 4

Balancing condition:
For balancing input file, we need to use the HEADER record data.
(a) compare key data1 count present in the Header record with detail record count i.e. Key data 1(1111) count present in position 9,4 in the header record should be equal to calculated detail record count for 1111.

(b) Similarly for the key data 2 and key data 3.

I am able to achieve the said explanation by using below ICETOOL step:

//TOOLIN DD *
SORT FROM(INP01) TO(T1) USING(CTL1)
COUNT FROM(T1) EMPTY USING(CTL2) RC4
COUNT FROM(T1) EMPTY USING(CTL3) RC4
COUNT FROM(T1) EMPTY USING(CTL4) RC4

//CTL1CNTL DD *
INCLUDE COND=((1,4,CH,EQ,C'HEADER'),OR,
(1,4,CH,EQ,C'1111'),OR,
(1,4,CH,EQ,C'2222'),OR,
(1,4,CH,EQ,C'3333'))
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(100:C'0000',
104:C'0000',
108:C'0000',
112:C'0000',
116:C'0000000000',
126:C'0000000000')),
IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),
OVERLAY=(100:13,4,
104:C'0000',
108:21,4,
112:C'0000',
116:29,10,SFF,T0=ZD,LENGTH=10,
126:C'0000000000'),HIT=NEXT),
IFTHEN=(WHEN=(1,4,CH,EQ,C'1111'),
OVERLAY=(100:C'0000',
104:C'0001',
108:C'0000',
112:C'0000',
116:C'0000000000',
126:C'0000000000'),HIT=NEXT),
IFTHEN=(WHEN=(1,4,CH,EQ,C'2222'),
OVERLAY=(100:C'0000',
104:C'0000',
108:C'0000',
112:C'0001',
116:C'0000000000',
126:C'0000000000'),HIT=NEXT),
IFTHEN=(WHEN=(1,4,CH,EQ,C'3333'),
OVERLAY=(100:C'0000',
104:C'0000',
108:C'0000',
112:C'0000',
116:C'0000000000',
126:5,10,SFF,TO=ZD,LENGTH=10),HIT=NEXT),
SORT FIELDS=(1,4,CH,A)
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(' BALANCE: ',
11:'HEAD-1111:',21:TOT=(100,4,UFF,TO=ZD,LENGTH=4),
31:' 1111:',37:TOT=(104,4,UFF,TO=ZD,LENGTH=4),
47:' HEAD-2222:',58:TOT=(108,4,UFF,TO=ZD,LENGTH=4),
68:' 2222:',74:TOT=(112,4,UFF,TO=ZD,LENGTH=4),
84:' HEAD-3333:',95:TOT=(116,10,SFF,EDIT=(TTTTTTT.TT)),
112:' CA01:',118:TOT=(126,10,SFF,EDIT=(TTTTTTT.TT))),
BUILD=(1,135)
//CTL2CNTL DD *
INCLUDE COND=(21,4,ZD,EQ,37,4,ZD)
//CTL3CNTL DD *
INCLUDE COND=(58,4,ZD,EQ,74,4,ZD)
//CTL4CNTL DD *
INCLUDE COND=(95,10,ZD,EQ,118,10,ZD)

ICETOOL is working fine for the explained scenario.

I am facing an issue if i pass the Header data as below
HEADER 1111A003222200023333 30.00
i.e. for key data 1(1111), if i pass A003 as count, CTL2 is completing succesfully, i am expecting it to complete with RC4 since the counts don't match.

Similarly , if i pass the amount as 1000030.00 in the Header record, CTL4 is completing successfully, where as i am expecting it to complete with RC4.

Could you please help!

Please note that, I have reformatted and repositioned the ICETOOL step as per the sample data provided .

Thanks,
Siri

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Fri Sep 10, 2010 12:31 am

Why would you pass A003 as a count - what does that represent given that A is not a valid decimal number?

Code: Select all

//CTL3CNTL DD * 
  INCLUDE COND=(58,4,ZD,EQ,74,4,ZD) 
//CTL4CNTL DD * 
  INCLUDE COND=(95,10,ZD,EQ,118,10,ZD) 
I don't have the time to figure out what's in these fields when you do the comparisons.

Please show me in hex what is in each of these fields when they are compared.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

sirianangel
Member
Posts: 12
Joined: Sun Aug 22, 2010 1:57 am

Post by sirianangel » Fri Sep 10, 2010 8:32 am

Hi Frank,

Please find sample output file that would be generated from CTL1.
*I/p fl 1111 value* *Calculate vl* *I/p fl 2222 value**Calculate vl*
BALANCE: HEAD-1111:0003 0003 HEAD-2222:0002 0002 HEAD-3333:000030.00 000030.00
*I/p fl 3333 value* *Calculate vl*

Now, in this output file, I am comparing the input fl value with calculate value. I am performing this check to see, if the HEADER segment values passed in the input file tally with the detail record.

In order to verify the same, I am testing to see if all data scenarios are compatible with the ICETOOL step i have written.

In doing so, I have tried with below data in the HEADER segment of input file.
HEADER 1111A003222200023333 000030.00
1111
1111
1111
1114
2222
2222
2224
3333 000010.00
3333 000010.00
3333 000010.00
4444

Since the key data1 of Header segment is having count as A003, i am expecting ICETOOL to complete with RC4 since the values would not match. But unfortunately , ICETOOL is completing successfully.

Here, Do i need to change the data formats used in the ICETOOL to throw RC4 in CTL2.

Thanks,
Siri

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Sat Sep 11, 2010 1:08 am

I'm trying to help, but you're not giving me the information I asked for so it's difficult.
Since the key data1 of Header segment is having count as A003, i am expecting ICETOOL to complete with RC4 since the values would not match. But unfortunately , ICETOOL is completing successfully.
Which INCLUDE condition is giving the "unexpected" result? What are the actual values in hex that are being compared? X'C1F0F0F3' is one value? What is the value it is being compared to in hex? Is it X'F0F0F0F3' or something else?

Let's try to break it down to simpler terms.

Note that for this job, DFSORT/ICETOOL returns RC4:

Code: Select all

//S1    EXEC  PGM=ICETOOL                 
//TOOLMSG DD SYSOUT=*                     
//DFSMSG  DD SYSOUT=*                     
//T1 DD *                                 
                    A003           0003   
//TOOLIN DD *                             
COUNT FROM(T1) EMPTY USING(CTL2) RC4      
//CTL2CNTL DD *                           
  INCLUDE COND=(21,4,ZD,EQ,37,4,ZD)       
/*
What is the equivalent for the job you're talking about that doesn't give RC4?

Note that the ZD value for C'A003' (X'C1F0F0F3') is +1003 whereas the ZD value for C'0003' (X'F0F0F0F3') is +0003 which is different, so the INCLUDE condition would NOT be met and the file would be empty. But if you want to compare a non-ZD value like C'A003' to a ZD value like C'0003', you might want to use BI instead of ZD as long as the values always have consistent signs (e.g. C for plus and D for minus).
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

sirianangel
Member
Posts: 12
Joined: Sun Aug 22, 2010 1:57 am

Post by sirianangel » Sun Sep 12, 2010 4:34 am

Sorry frank for not giving you clear details..

I have reformatted ICETOOL step to include only KEYDATA1 to give more clear details about the issue.
Sample Input Data:
Header layout-
position 1,8(CH) - 'HEADER '
position 9,4(CH) - '1111'
position 13,4(9(4)) - count (As per the sample data, i am assuming this could be represented by UFF)


Detail record layout-
position 1,4(CH) - key data

Sample Input data-
HEADER 11110003
1111
1111
1111
1114
2222
2222
2224
3333 10.00
3333 10.00
3333 10.00
4444

Expected output:
Execute ICETOOL on the input data and balance. If INPUT data is not balanced, set return code 4

Balancing condition:
For balancing input file, we need to use the HEADER record data.
(a) compare key data1 count present in the Header record with detail record count i.e. Key data 1(1111) count present in position 9,4 in the header record should be equal to calculated detail record count for 1111.

//TOOLIN DD *
SORT FROM(INP01) TO(T1) USING(CTL1)
COUNT FROM(T1) EMPTY USING(CTL2) RC4

//CTL1CNTL DD *
INCLUDE COND=((1,4,CH,EQ,C'HEADER'),OR,
(1,4,CH,EQ,C'1111'))
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(100:C'0000',
104:C'0000')),
IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),
OVERLAY=(100:13,4,
104:C'0000'),HIT=NEXT),
IFTHEN=(WHEN=(1,4,CH,EQ,C'1111'),
OVERLAY=(100:C'0000',
104:C'0001'),HIT=NEXT),
SORT FIELDS=(1,4,CH,A)
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(' BALANCE: ',
11:'HEAD-1111:',21:TOT=(100,4,UFF,TO=ZD,LENGTH=4),
31:' 1111:',37:TOT=(104,4,UFF,TO=ZD,LENGTH=4)),
BUILD=(1,40)
//CTL2CNTL DD *
INCLUDE COND=(21,4,ZD,EQ,37,4,ZD)


After executing above ICETOOL step with sample Input file as input, Output file (T1) would look like this.

T1 output file:
BALANCE: HEAD-1111:0003 1111:0003
xxxx yyyy
CTL2 would check the positions, 21,4 position value (i.e.xxxx - Input HEADER represented value) with 37,4 position value(i.e. yyyy - Calculated by ICETOOL value) to be equal. If equal, CTL2 will complete succesfully with RC 0 otherwise it would complete with RC4.

Coming to the issue scenario that we were discussing, i.e if i pass Input file as below:
HEADER 1111A003
1111
1111
1111
1114
2222
2222
2224
3333 10.00
3333 10.00
3333 10.00
4444

After executing ICETOOL step, T1 output file is generated as below:
T1 output file:
BALANCE: HEAD-1111:0003 1111:0003
xxxx yyyy

XXXX - Input header represented value in T1 output file is coming as 0003 but i was expecting it to A003.

For some reason, Input Header value 'A003' in the CTL1 is getting converted to '0003'.

Could you please take a look.

Thanks,
Siri

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others