Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Syncsort: Change a column value depending on other column

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
nithya_s_raman

New User


Joined: 30 Oct 2007
Posts: 3
Location: India

PostPosted: Wed Oct 31, 2007 1:51 pm    Post subject: Syncsort: Change a column value depending on other column
Reply with quote

I have an input file length = 300. In the output file I need to have the column position 251-253 changed to '01 ' if column 33-35 is '29 '. Is it possible to do so in a single sort step?
Back to top
View user's profile Send private message

Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Oct 31, 2007 1:56 pm    Post subject: Reply to: To change a column value depending on other column
Reply with quote

nithya,

Yes, this is possible with the OVERLAY command.

Quote:
I need to have the column position 251-253 changed to '01 ' if column 33-35 is '29


check if you have mentioned the correct column no's as cols 251 - 253 (3 bytes) and you want that to be replaced with a 2 byte value.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Wed Oct 31, 2007 2:00 pm    Post subject:
Reply with quote

Nithya,

Second thought -

Check this link for an example -

http://www.ibmmainframes.com/viewtopic.php?t=25280&highlight=overlay
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Oct 31, 2007 2:03 pm    Post subject: Reply to: To change a column value depending on other column
Reply with quote

nitya,

Code:
//S2    EXEC  PGM=ICEMAN                                             
//SYSOUT    DD  SYSOUT=*                                             
//SORTIN DD DSN= input file,DISP=SHR                         
//SORTOUT DD DSN=output file,DISP=(,CATLG,DELETE)           
//SYSIN    DD    *                                                   
  SORT FIELDS=COPY                                                   
  INREC IFTHEN=(WHEN=(33,2,CH,EQ,C'29'),OVERLAY=(251:C'01'))   
/*   
Back to top
View user's profile Send private message
nithya_s_raman

New User


Joined: 30 Oct 2007
Posts: 3
Location: India

PostPosted: Wed Oct 31, 2007 2:51 pm    Post subject: Re:To change a column value depending on other column
Reply with quote

I tried using the options provided, but when I run the job its giving syntax error. Maybe IFTHEN and OVERLAY are not supported by syncsort.

Thanks for all your help.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Wed Oct 31, 2007 2:59 pm    Post subject:
Reply with quote

Nitya,

Post the spool messages. May be some will help you out.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Oct 31, 2007 3:00 pm    Post subject: Reply to: To change a column value depending on other column
Reply with quote

nithya,

Quote:
Maybe IFTHEN and OVERLAY are not supported by syncsort.


What version of SYNCSORT are you using? Try using BUILD instead of OVERLAY

Code:
SORT FIELDS=COPY                                                   
  INREC IFTHEN=(WHEN=(33,2,CH,EQ,C'29'),BUILD=(1,250,251:C'01',253,48)) 
Back to top
View user's profile Send private message
nithya_s_raman

New User


Joined: 30 Oct 2007
Posts: 3
Location: India

PostPosted: Wed Oct 31, 2007 3:20 pm    Post subject: Reply to: To change a column value depending on other column
Reply with quote

I think the version of syncsort is 1.1
The build option is also not working. here is a copy of the spool.
SYSIN :
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(33,3,CH,EQ,C'29 '),
*
BUILD=(1,250,251:C'01 ',254,47))
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Oct 31, 2007 3:45 pm    Post subject: Reply to: To change a column value depending on other column
Reply with quote

Nitya,

Quote:
Maybe IFTHEN and OVERLAY are not supported by syncsort.


Even am using SYNCSORT but the version is not the one which you are using. As you said IFTHEN and OVERLAY are not supported by the SYNCSORT version which you are using.
Back to top
View user's profile Send private message
skkp2006

New User


Joined: 14 Jul 2006
Posts: 93
Location: Chennai,India

PostPosted: Wed Oct 31, 2007 5:00 pm    Post subject: Reply to: To change a column value depending on other column
Reply with quote

Can u try this ????

Code:
   OPTION COPY
   INREC IFTHEN=(WHEN=(33,2,CH,EQ,C'29'),OVERLAY=(251:C'01'))



Syam
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Oct 31, 2007 6:19 pm    Post subject:
Reply with quote

skkp2006
What version of SYNCSORT you are using?
Check it in SPOOL, and let us know!
Back to top
View user's profile Send private message
skkp2006

New User


Joined: 14 Jul 2006
Posts: 93
Location: Chennai,India

PostPosted: Thu Nov 01, 2007 9:35 am    Post subject: Reply to: Syncsort: Change a column value depending on other
Reply with quote

I am using SYNCSORT FOR Z/OS 1.2.2.2R. I think that the above code requires SyncSort for z/OS 1.2.1 or later.

Syam
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Nov 02, 2007 11:05 am    Post subject: Re: Reply to: Syncsort: Change a column value depending on o
Reply with quote

skkp2006 wrote:
I am using SYNCSORT FOR Z/OS 1.2.2.2R. I think that the above code requires SyncSort for z/OS 1.2.1 or later.

Syam

Have no idea as to exactly from which version the SYNCSORT has capability for IFTHEN.
icon_idea.gif The only way of verification i could think of is, if the * is exactly below the IFTHEN then you dont have facility of IFTHEN.
Like this
Code:
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(33,3,CH,EQ,C'29 '),
      *
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am
No new posts Fail to change physical VSAM filename... jacobdng CICS 7 Fri Jan 20, 2017 12:36 pm
This topic is locked: you cannot edit posts or make replies. DB2 query Using Recursion, Converting... smilewithashu2 DB2 3 Tue Jan 03, 2017 12:50 pm
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us