Posted: Mon Oct 18, 2010 12:46 pm Post subject: SYCNSORT - Assert a negative sign & REPRO to VSAM file
I'm supporting an application that is using a packed decimal field as a key to a VSAM file. The numerical (absolute) value is guaranteed to be unique. The negative sign is being used as a flag that the record needs to be corrected. When the record is updated, the sign is flipped to a positive value.
In this particular situation, the vsam file is loaded by a syncsort step. I'm wanting to take advantage of this syncsort to assert that all records passing through the step have the negative sign correctly set before loading the file.
I have managed to construct control cards (below) that will assert the sign of the packed decimal key. Unfortunately I'm stimied by the fact this requires two OUTFIL statements which splits the output into separate files. I want to combine all the output into a SINGLE file for loading the VSAM file.
Is there a way around this delima?
Code:
*
* This sort logic is intended to force all Packed Decimal amounts to
* have a negative sign with a B'....1101' value (Hex 'xD').
*
SORT FIELDS=COPY
OUTFIL FILES=1,
INCLUDE=(8,1,BI,NE,B'....1..1',OR, * POSITIVE PACKED DECIMAL
8,1,BI,EQ,B'....1111'), * UNSIGNED PACKED DECIMAL
OUTREC=(1:1,7, * INCLUDING +0
8:(-1,MUL,8,1,PD),PD,LENGTH=1,
9:9,72)
OUTFIL FILES=2,
INCLUDE=(8,1,BI,EQ,B'....1..1',AND, * NEGATIVE PACKED DECIMAL
8,1,BI,NE,B'....1111'), * NOT UNSIGNED PACKED DECIMAL
OUTREC=(1:1,7, * INCLUDING -0
8:(+1,MUL,8,1,PD),PD,LENGTH=1,
9:9,72)
I have not run the above code with test data; please confirm whether this accomplishes what you need. _________________ Brian Wood
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Thanks for your example. Sorry about my slow reply, I've been out-of-pocket with family health issues.
I think we're using an older version of Syncsort but I will investigate what the plans are for installing the new release. The IFTHEN, WHEN, and BUILD commands are very interesting and seem to provide the answer I'm seeking.
I have not run the above code with test data; please confirm whether this accomplishes what you need.
Brian,
I was pleased to learn we are using the current version of SyncSort and your solution worked as suggested. My manual was out of date. Thanks for your assistance.
Mike
PS: This is the final solution I came up with, borrowing from papadi's suggestion to use OVERLAY as well.
Code:
*
* This MERGE logic is intended to assert that the Packed Decimal
* field has a negative sign with a B'....1101' value (Hex X'.D').
*
*
MERGE FIELDS=(27,5.4,BI,A),EQUALS
SUM FIELDS=NONE
OUTREC IFTHEN=(WHEN=(32,1,BI,NE,B'....1..1',OR,
32,1,BI,EQ,B'....1111'),
OVERLAY=(32:(-1,MUL,32,1,PD),PD,LENGTH=1)),
IFTHEN=(WHEN=(32,1,BI,EQ,B'....1..1',AND,
32,1,BI,NE,B'....1111'),
OVERLAY=(32:(+1,MUL,32,1,PD),PD,LENGTH=1))
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum