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 

Sort help needed in Processing VSAM Input file
Goto page Previous  1, 2
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
eureka19
Beginner


Joined: 02 Oct 2005
Posts: 20
Topics: 9

PostPosted: Tue Oct 04, 2005 4:12 am    Post subject: Reply with quote

Phantom,

Is it possible to check the key value and then update some other field in the file using sort.

For Example,
Code:

123456789HOUSTONYDELIVERED
222222222NEWYORKYDELIVERED

Here first 9 bytes form the key.suppose i want to change 'Y' to 'N' in column 17 for Key value 123456789.

Is this possible in SORT?

Assume the copy booklayout is as follows
RECORD-KEY
PLACE
FLAG
STATUS


TIA,
Eureka
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Tue Oct 04, 2005 4:59 am    Post subject: Reply with quote

Eureka19,

Using CHANGE operator you can check for any literal value (in any position) and change it to another literal. The only problem with CHANGE parameter is that, it does not support variables, since you need to hardcode all possible cases in the sort card.

Ok...Here is the sort card for your case.
Code:

  SORT FIELDS=(p,l,f,a)
  OUTREC FIELDS=(1,16            * Copy first 16 bytes as it is  *
                 1,9,CHANGE=(1,      * Check in first 9 bytes & Change to 1 byte *
                 C'123456789',C'N'), * Change literal 123456789 to 'N' *
                 NOMATCH=(17,1))     * Else copy contents of 17th column *


Note: The above card will replace the contents of Column 17 to 'N' if Key = 123456789. This is done irrespective of the original contents of Column 17.

If you have a special case like this, Then you need to change the card as shown below
Code:

  IF KEY=123456789  AND  COL-17 = 'Y' THEN
      Change 'Y'  to 'N'


Code:

  INREC FIELDS=(1,16,           * Copy first 16 bytes as it is *
                17,1,           * Original contents of Col 17 *
                1,9)                 * Copy first 9 bytes again @ col 18 *


  OUTREC FIELDS=(1,16             * Copy first 16 bytes as it is  *
                 17,10,CHANGE=(1,     * Check 10 bytes from 17        *
                 C'Y123456789',C'N'), * Change literal Y123456789 to 'N' *
                 NOMATCH=(17,1))      * Else copy contents of 17th column *


Hope this helps,

Let us know if you need more info.

Regards,
Phantom
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12382
Topics: 75
Location: San Jose

PostPosted: Tue Oct 04, 2005 5:01 am    Post subject: Reply with quote

eureka19,

eureka19,

You can use the change operator to change the value based on another value.If your File is FB and lrecl of 80, then you can use the following cards

ex:
Code:

 SORT FIELDS=COPY
 OUTREC FIELDS=(1,16,
                17:1,9,CHANGE=(1,C'123456789',C'N'),NOMATCH=(17,1),
                18,63)


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Oct 04, 2005 10:36 am    Post subject: Reply with quote

DFSORT's IFTHEN and OVERLAY functions are much more flexible than CHANGE for doing this kind of thing, especially when it comes to multiple conditions.

The first case could be done like this with DFSORT:

Code:

    OUTREC IFTHEN=(WHEN=(137,2,CH,EQ,C'CD'),OVERLAY=(132:C'DD'))


The second case could be done like this with DFSORT:

Code:

   OUTREC IFTHEN=(WHEN=(1,9,CH,EQ,C'123456789'),OVERLAY=(17:C'N'))


The third case could be done like this with DFSORT:

Code:

   OUTREC IFTHEN=(WHEN=(1,9,CH,EQ,C'123456789',AND,17,1,CH,EQ,C'Y'),
       OVERLAY=(17:C'N'))


You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's IFTHEN and OVERLAY. Only DFSORT has these functions, so if you don't have DFSORT, you won't be able to use them. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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