Subtraction using JCL sort



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Subtraction using JCL sort

Postby Shweta Jain » Sat May 25, 2013 10:51 am

I have a VB file of 80 bytes and I have to sort this file based on 1-3 bytes(key field) and then sum next 12 bytes for similar key values and subtract 4 from it and store the output in a VB file.

I have generated a JCl which sorts the file and calculates the sum of next 12 byte for similar key values. PFB the sort cord:
sort fields=(5,3,ch,a)
Sum fields=(8,12,ZD)
Outrec=(5:5,3,8:8,12,ZD)
Here I have used 5 because its an VB file and in VB file 1-4 bytes are reserved.

Input file data:
K01000000000010
K01000000000010
K02000000000010

Output file data:
K01000000000020
K02000000000010
Here sum is 12 bytes long.

Now as I have to subtract 4 from the sum I have changed my sort card as given below:
sort fields=(5,3,ch,a)
Sum fields=(8,12,ZD)
Outrec=(5:5,3,8:8,12,ZD,SUB,+4,M11)

On using above sort card I got unexpected result:
Output data:
K01000000000000016
K02000000000000006

The sum is now 15 bytes long instead of 12 bytes.

Can anybody please tell me why on using SUB keyword the size increases from 12 to 15bytes.
Shweta Jain
 
Posts: 2
Joined: Sat May 25, 2013 10:17 am
Has thanked: 1 time
Been thanked: 0 time

Re: Subtraction using JCL sort

 

Re: Subtraction using JCL sort

Postby BillyBoyo » Sat May 25, 2013 11:27 am

Because you haven't said how long you want the result to be, so you get the default length.

You can specify the length with LENGTH= or with an EDIT.

These users thanked the author BillyBoyo for the post:
Shweta Jain (Sat May 25, 2013 12:33 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Subtraction using JCL sort

Postby Shweta Jain » Sat May 25, 2013 12:21 pm

Thanks a lot Billy. :)
Shweta Jain
 
Posts: 2
Joined: Sat May 25, 2013 10:17 am
Has thanked: 1 time
Been thanked: 0 time

Re: Subtraction using JCL sort

Postby NicC » Sat May 25, 2013 1:21 pm

Why was this posted in the FAQ section? Moving to DFSort but if you use another sort product (look at your sort messages) let us know and it will be moved to the correct section. And a quick note on terminology - the JCL does NOT sort your input - Sort does. It is a program, not JCL and its control card are sort control cards - again...not JCL.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post