View previous topic :: View next topic
|
Author |
Message |
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
Hi,
Can you please help me with a solution for an issue.
Input file:
Code: |
1234567890-000000160-000000156
1234567890-000000159 000000155
1234567890 000000158-000000154
|
The sort card I used to convert SFF to ZD is,
Code: |
SORT FIELDS=COPY
OUTREC BUILD=(1,10,
10,10,SFF,TO=ZD,
20,10,SFF,TO=ZD) |
The sort card used to convert back to SFF format is,
Code: |
SORT FIELDS=(1,10,CH,A)
SUM FIELDS=(10,10,20,10),FORMAT=ZD |
Note: I do have 80 columns to be summed up like this. I have mentioned two of it as an sample.
Expected Output file:
Code: |
1234567890-000000161-000000155 |
But am getting output as,
Code: |
123456789000000001610000000155 |
Query:
How can I get it back to SFF format(original format) after addition. Can you please help me ?.
Thanks
Abdul Rafi |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
One way to solve is to make a use of EDIT/SIGN option in SECTIONS and TRAILER3. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1255 Location: Bamberg, Germany
|
|
|
|
SECTIONS would work if it is presorted already. It makes more sense to me to first convert the SFF (or CSF) fields to PD and SUM them up then. OUTREC/OUTFIL will later do what's requested using the suggested EDIT and SIGNS method. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Ok, just from an admin point of view.
Please explain to me what the hell this topic has to do with VSAM or JCL.
Pleeeeeeease do not tell me that you are running a JCL for this
There are two forum sections, on each for both of the major sort products, just in case that you had not noticed.
So which sort product are you using, and it's release level - and the topic will be moved accordingly.
If no response is receive the topic will be locked. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1255 Location: Bamberg, Germany
|
|
|
|
@expat: Move it to DFSORT section please. Guess that is the closest match. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
SORT FIELDS=(1,10,CH,A)
SUM FIELDS=(10,10,20,10),FORMAT=ZD |
If your sort key is at position 1-10, I'd assume your sum field would start at pos-11 instead of 10. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1255 Location: Bamberg, Germany
|
|
|
|
Last line of the sample input should have two spaces after the key I'd say. Best way to avoid any overlaps seem to be a PARSE with FIXLEN=10 and REPEAT. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
Joerg.Findeisen, Right and TS is sorting the records in the snippet shown in the first post , that can be leveraged in SECTIONS solution.
Let us wait for TS to respond us further. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1255 Location: Bamberg, Germany
|
|
|
|
@Rohit: You are right of course, thanks for pointing that out to me. I started right away with having had a look at the two sort steps initially provided. Your proposal is the easiest one as it does not require any previous converts.
If there are additional conditions to be applied I'd rather use the SUM statement instead.
Cheers,
Joerg |
|
Back to top |
|
|
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
Hi Rohit,
I achieved it using EDIT/SIGN. Thanks for your help. I need one more help on the same.
Input file: I do have the same record with header and trailer and also some additional records in the same file.
Code: |
H20190129000000
1234567890 -000000160-000000156
1234567890 -000000159 000000155
1234567890 000000158-000000154
T00003
H20190129000000
1234567890 -000000160-000000156
1234567890 -000000159 000000155
1234567890 000000158-000000154
1234567890 000000158-000000154
T00004
|
Expected output:
I do have few more columns in input file, using keys I am summing it up and I have to update the trailer count for that particular Header and Trailer like below. Here for ex, am grouping and summing up the second set and the output has to be like,
Code: |
H20190129000000
1234567890 -000000160-000000156
1234567890 -000000159 000000155
1234567890 000000158-000000154
T00003
H20190129000000
1234567890 -000000160-000000156
1234567890 -000000159 000000155
1234567890 000000158-000000154
T00003
|
Can you please help me a way to achieve it ?. I can have how many ever Header and trailer in the same file. but it has to update only for that particular set. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
abdulrafi,
Quote: |
Here for ex, am grouping and summing up the second set |
What amount have you summed up in the second set? Looks like you just got rid of the last duplicate record. After summing on the keys, will it not be one record for the key-1234567890 in the second set?
Quote: |
it has to update only for that particular set
|
How do you identify a 'particular set'? |
|
Back to top |
|
|
|