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 

Can we have multiple conditions for the CHANGE statement

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


Joined: 29 Nov 2005
Posts: 26
Topics: 9

PostPosted: Fri Dec 09, 2005 10:49 am    Post subject: Can we have multiple conditions for the CHANGE statement Reply with quote

Hi

I am trying to do a sort step whcih can add columns based on 2 fields. The 2 fields are at possitions 40,1,CH and 212,2,BI.

The condition is this
Code:

IF (40,1) = 'P' Then
    IF (212,2) = X'0002' or X'0001' Then
        MOVE (226,4) TO the position 33
    ELSE
        MOVE X'00000000000C' TO the position 33
    END-IF
END-IF

I tried to do the below Overlay statement but I feel it is not supported by SYNCSORT. We do not have DFSORT. What I would like to know is another alternative to the below. I understand that I could do it easily by splittig the process into 2 SORTs but is there a way I could do it with one.
Code:

SORT FIELDS=(1,13,CH,A)                                               
INREC OVERLAY=(1,5,C' ',               
         17,3,C'  ',                   
         45,2,C'   ',                 
         47,2,                       
         20,10,                       
         X'00000001',           
         40,1,CHANGE=(2,C'P',212,2),NOMATCH=(X'0000'),   
         33:33,2,CHANGE=(6,X'0004',222,4,X'0001',222,4),
               NOMATCH=(X'00000000000C'))             


Thanks
PK
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Fri Dec 09, 2005 11:35 am    Post subject: Reply with quote

Quote:
I tried to do the below Overlay statement but I feel it is not supported by SYNCSORT.


With DFSORT, you could do it with IFTHEN. But only DFSORT supports IFTHEN and OVERLAY. Syncsort does not support these features.
_________________
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
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Dec 09, 2005 11:38 am    Post subject: Reply with quote

pknair,

Syncsort does not support change on multiple fields. So you need to re-arrange them as 1 field and then apply the change parm.


Try this . I assumed that you input file has the following attributes
Code:

LRECL=250,RECFM=FB


I also assumed that you wanted to change ONLY 4 bytes at position 33, since you are overlaying the contents from pos 224 for only 4 bytes.

We add the contents at 40 for a length of 1 and 212 for a length of 2 at the end of every record using inrec fields.

Now 'P' in hex is d7, so we validate both the fields in hex and use the change operator.

Code:

//SYSIN     DD *                                           
 SORT FIELDS=COPY                                           
 INREC FIELDS=(01,250,                                       
               40,1,                                         
               212,2)

 OUTREC FIELDS=(1,250,                                       
                251,3,CHANGE=(4,X'D70001',X'11111111',       
                                X'D70002',X'11111111'),       
                                NOMATCH=(X'0000000C'))       
 OUTFIL OUTREC=(1,32,                                         
                33:251,4,CHANGE=(4,X'0000000C',X'0000000C'),   
                                 NOMATCH=(226,4),
                37,214)             
/*                                                       


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
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