IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Syncsort - Two SORT fields in one SORT card.


 
IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: :: View next topic  
Author Message
janmejay
Warnings : 1

New User


Joined: 22 Jun 2007
Posts: 85
Location: bangalore

PostPosted: Wed Aug 29, 2012 7:07 pm
Reply with quote

I need to check two conditions in one sysin card, I have to look for a specific value at a position and if it satisfies I have to sort fields from X posn and if that value is not found at that position I have to sort it from Y position.
E.g. - If I get '13274' or '22026' at posn 19 then I have to sort the file from 1st posn and if not found I have sort from 19th posn- Below is the card I have used but I am getting Duplicate Statement error.

This is the card am using-

Code:
INREC IFTHEN=(WHEN=(19,10,CH,EQ,C'13274 ',OR,
                     19,10,CH,EQ,C'22026 '),OVERLAY=(25:C' '))
SORT FIELDS=(1,1,A,19,10,A,501,13,A,392,2,A,
488,8,A,499,1,A,54,8,A),FORMAT=BI
OPTION EQUALS
OUTREC IFTHEN=(WHEN=(19,10,CH,NE,C'13274 ',AND,
               19,10,CH,NE,C'22026 '),OVERLAY=(25:C' '))
SORT FIELDS=(19,10,A,1,1,A,501,13,A,392,2,A,
488,8,A,499,1,A,54,8,A)),FORMAT=BI   


Below is the error screen from spool-

Code:
 INREC IFTHEN=(WHEN=(19,10,CH,EQ,C'13274 ',OR,
                      19,10,CH,EQ,C'22026 '),OVERLAY=(25:C' '))
 SORT FIELDS=(1,1,A,19,10,A,501,13,A,392,2,A,
 488,8,A,499,1,A,54,8,A),FORMAT=BI
 OPTION EQUALS
 OUTREC IFTHEN=(WHEN=(19,10,CH,NE,C'13274 ',AND,
                19,10,CH,NE,C'22026 '),OVERLAY=(25:C' '))
 SORT FIELDS=(19,10,A,1,1,A,501,13,A,392,2,A,
 *
 488,8,A,499,1,A,54,8,A)),FORMAT=BI
WER269A SORT STATEMENT : DUPLICATE STATEMENT FOUND
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE   

Am using SORT.

Thanks in advance.!!!

Coded' - Anuj
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19251
Location: Inside the Matrix

PostPosted: Wed Aug 29, 2012 7:24 pm
Reply with quote

Hello,

You can have only one SORT FIELDS per execution.

If you show some sample input data and the output you want when this sample data is processed, someone may have a suggestion.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7312
Location: Inside the Matrix

PostPosted: Wed Aug 29, 2012 7:34 pm
Reply with quote

A bit of judicious searching on this site but not this forum will get you to a recent similar requirement, with a solution which may or may not work for you, but should get you started at least.
Back to top
View user's profile Send private message
Dale Robertson

New User


Joined: 21 Jun 2013
Posts: 44
Location: U.S.A.

PostPosted: Wed Jun 26, 2013 2:28 am
Reply with quote

janmejay,

INREC IFTHEN=(WHEN=(19,10,CH,EQ,C'13274 ',OR,
19,10,CH,EQ,C'22026 '),OVERLAY=(25:C' '))

SORT FIELDS=(1,1,A,19,10,A,501,13,A,392,2,A,
488,8,A,499,1,A,54,8,A),FORMAT=BI
OPTION EQUALS

OUTREC IFTHEN=(WHEN=(19,10,CH,NE,C'13274 ',AND,
19,10,CH,NE,C'22026 '),OVERLAY=(25:C' '))

SORT FIELDS=(19,10,A,1,1,A,501,13,A,392,2,A,
488,8,A,499,1,A,54,8,A)),FORMAT=BI


Other than the obvious repeat of the SORT instruction, one thing you do that is a good thing is that you seem to understand how sort works - INREC then SORT then OUTREC. Although it's not necessary to code that way by doing so things become clearer and you can see your errors when you make them - which is what we do for a living when you think about it.

r

Bravo.
--Manko - For a Few Dollars More.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7312
Location: Inside the Matrix

PostPosted: Wed Jun 26, 2013 3:07 am
Reply with quote

1) Please "Green Screen" it, and use the Code Tags to preserve spacing. In the Code tags, the enhancement of text doesn't work (like Bolding) but life's like that at times...

2) Not certain, but I have half a feeling that the TS was trying to read and sort one file with INREC and a second with OUTREC.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> SYNCSORT
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts COBOL VS SORT Utility for file format... COBOL Programming 6
No new posts Copying data from prev record using SORT SYNCSORT 19
No new posts Combining more 4 files with sorted or... DFSORT/ICETOOL 3
No new posts Break a record into fields, each fiel... SYNCSORT 2
No new posts SYNCSORT Error - CONTROL FIELD BEYOND... SYNCSORT 10

Back to Top