IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

[Solved]Change the first three position using SYNCSORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Magna

New User


Joined: 30 Oct 2006
Posts: 24

PostPosted: Thu Nov 09, 2006 10:20 am
Reply with quote

I have a file with header,trailer and detial record.
I need to change the first three position of these records with different values.
and the syntax am using for this in syncsort is
SORT FIELDS=COPY
OUTREC FIELDS=(1,3,CHANGE=(3,C'xxx',C'yyy',
C'aaa',C'bbb',
C'ccc',C'ddd'),4,157)
Here in header I have XXX which I'm changinf to YYY
and in detail i have AAA which I'm changing to BBB
and in trailer i have ccc and i'm changing that to ddd

I need to add one more condition
where i need to change the 7th position(that field is of length 13)
in my header and trailer to some other value of same length.
I need to include this condition in the same sort card.
Could someone tell me the syntax for that in syncsort.

The file length is 160.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Thu Nov 09, 2006 10:32 am
Reply with quote

Use syntax like below for all your conditions to replace first 3 chars...
Code:
SORT FIELDS = COPY
OUTREC = (1:1,3,
CHANGE=(3,C'TTT',C'YYY',C'AAA',C'BBB',C'CCC',C'DDD'),NOMATCH=(1,3),
4:4,157)


To replace 13 chars starting at 7th position in Header & Trailer, do you have any specific values coming into that field.?
Back to top
View user's profile Send private message
Magna

New User


Joined: 30 Oct 2006
Posts: 24

PostPosted: Thu Nov 09, 2006 11:03 am
Reply with quote

Yes I have a value for that 13 length field which is
POST POSITION
and i need to change it to
POST ACTIVITY
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Thu Nov 09, 2006 11:09 am
Reply with quote

okay... then use the below mentioned SORT CARD...
Code:
SORT FIELDS = COPY
OUTREC = (1:1,3,
CHANGE=(3,C'TTT',C'YYY',C'AAA',C'BBB',C'CCC',C'DDD'),NOMATCH=(1,3),
4:4,3,
7:7,13,
CHANGE=(13,C'POST POSITION',C'POST ACTIVITY',NOMATCH=(7,13),
20:20,141)


Note: Any of your DETAIL records containing "POST POSITION" at 7-13 positions would also be converted to "POST ACTIVITY". So make sure you dont have any such record in DETAIL Records before running the query.

To resolve this; what else is there in positions 4-6 in your HEADER & TRAILER records.
Back to top
View user's profile Send private message
Magna

New User


Joined: 30 Oct 2006
Posts: 24

PostPosted: Thu Nov 09, 2006 11:18 am
Reply with quote

I may get a value of 001 or 002 or 003 or 004 in the position 4-6
but i don't want to change that position... would that create any problem...
The condition u gave worked fine...
Thanks a lot....
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Thu Nov 09, 2006 11:25 am
Reply with quote

Quote:
I may get a value of 001 or 002 or 003 or 004 in the position 4-6
but i don't want to change that position... would that create any problem...

No that would not create a problem... I asked to make conditions more specific.
Quote:
The condition u gave worked fine...
Thanks a lot....

Thats fine... but did you notice the note made in my earlier reply. If that is not the case, this SORT is perfact, otherwise we may need to update the SORT CARD.
Back to top
View user's profile Send private message
Magna

New User


Joined: 30 Oct 2006
Posts: 24

PostPosted: Thu Nov 09, 2006 11:28 am
Reply with quote

nope I'll not get that value in the position 7 in my detail records.
but if am going to get it how can we handle that condition?
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Thu Nov 09, 2006 11:36 am
Reply with quote

Quote:
nope I'll not get that value in the position 7 in my detail records.

Then we are fine with the code given above.
Quote:
but if am going to get it how can we handle that condition?

I would put two different SORT CARDS for DETAIL and HEADER/TRAILER.
Code:
SORT FIELDS = COPY
OUTREC = (1:3,
CHANGE=(3,C'AAA',C'BBB',NOMATCH=(1,3),
4:4,157)

Code:
SORT FIELDS = COPY
OUTREC = (1:19,
CHANGE=(19,C'TTT001POST POSITION',C'YYY001POST ACTIVITY',
C'TTT002POST POSITION',C'YYY002POST ACTIVITY',
C'TTT003POST POSITION',C'YYY003POST ACTIVITY',
C'TTT004POST POSITION',C'YYY004POST ACTIVITY',
C'CCC001POST POSITION',C'DDD001POST ACTIVITY',
C'CCC002POST POSITION',C'DDD002POST ACTIVITY',
C'CCC003POST POSITION',C'DDD003POST ACTIVITY',
C'CCC004POST POSITION',C'DDD004POST ACTIVITY',
NOMATCH=(1,19),
20:20,141)
Back to top
View user's profile Send private message
Magna

New User


Joined: 30 Oct 2006
Posts: 24

PostPosted: Thu Nov 09, 2006 11:42 am
Reply with quote

Oh thats really useful... Thanks...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts 3270 personal communications. Can't c... TSO/ISPF 2
No new posts SELECT from data change table DB2 5
No new posts Trying to change copybook in online c... CICS 4
Search our Forums:

Back to Top