MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SYCNSORT - Assert a negative sign & REPRO to VSAM file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
JMCrockett
Beginner


Joined: 12 Oct 2010
Posts: 3
Topics: 1

PostPosted: Mon Oct 18, 2010 12:46 pm    Post subject: SYCNSORT - Assert a negative sign & REPRO to VSAM file Reply with quote

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)
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Tue Oct 19, 2010 1:23 pm    Post subject: Reply with quote

Which release of Syncsort is being used?

Suggest you look at IFTHEN and OVERLAY.
_________________
All the best,

di
Back to top
View user's profile Send private message
Brian Wood
Beginner


Joined: 14 Jan 2009
Posts: 37
Topics: 0
Location: USA

PostPosted: Thu Oct 21, 2010 9:31 am    Post subject: Reply with quote

JMCrockett:

Please try the following (requires SyncSort for z/OS Release 1.3):

Code:
//SYSIN  DD  *
  SORT FIELDS=COPY
  OUTREC IFTHEN=(WHEN=(8,1,BI,NE,B'....1..1',OR,
           8,1,BI,EQ,B'....1111'),
  BUILD=(1:1,7,
          8:(-1,MUL,8,1,PD),PD,LENGTH=1,
          9:9,72)),
  IFTHEN=(WHEN=(8,1,BI,EQ,B'....1..1',AND,
           8,1,BI,NE,B'....1111'),
  BUILD=(1:1,7,
          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
Back to top
View user's profile Send private message Send e-mail
JMCrockett
Beginner


Joined: 12 Oct 2010
Posts: 3
Topics: 1

PostPosted: Tue Oct 26, 2010 8:28 am    Post subject: Reply with quote

Brian,

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.

Mike
Back to top
View user's profile Send private message
JMCrockett
Beginner


Joined: 12 Oct 2010
Posts: 3
Topics: 1

PostPosted: Tue Oct 26, 2010 2:15 pm    Post subject: Reply with quote

Brian Wood wrote:
JMCrockett:

Please try the following (requires SyncSort for z/OS Release 1.3):

Code:
//SYSIN  DD  *
  SORT FIELDS=COPY
  OUTREC IFTHEN=(WHEN=(8,1,BI,NE,B'....1..1',OR,
           8,1,BI,EQ,B'....1111'),
  BUILD=(1:1,7,
          8:(-1,MUL,8,1,PD),PD,LENGTH=1,
          9:9,72)),
  IFTHEN=(WHEN=(8,1,BI,EQ,B'....1..1',AND,
           8,1,BI,NE,B'....1111'),
  BUILD=(1:1,7,
          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,

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))   
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group