Need help sort



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Need help sort

Postby shailaja85 » Thu May 16, 2013 7:27 pm

Hi,

Can some one help me please?

need to check first 3 digits, if it is non-zero(NZ) then in output it has NZ, if it is zero(ZE) then at end of the record it has to display ZE


my i/p is like below

111 AAA
222 BBB
000 CCC
333 DDD
000 EEE


Expected output
111 AAA NZ
222 BBB NZ
000 CCC ZE
333 DDD NZ
000 EEE ZE
shailaja85
 
Posts: 20
Joined: Fri Feb 10, 2012 5:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need help sort

Postby BillyBoyo » Thu May 16, 2013 8:21 pm

Have you tried anything? Have you a access to a SyncSort manual? If not, you should get one.

You can find a lot of example code here. You're going to need OPTION COPY (or SORT FIELDS=COPY), INREC IFTHEN=(WHEN=condition and OVERLAY. Have a crack at it. Let us know if you get stuck.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Need help sort

Postby shailaja85 » Thu May 16, 2013 9:18 pm

I have tried with the below
 SORT FIELDS=COPY,             
     IFTHEN=(WHEN=(1,3,EQ,0)),
     OVERLAY=(30:C'ZE')   


I am getting below error

SORT FIELDS=COPY,                       
    IFTHEN=(WHEN=(1,3,EQ,0)),           
    *                                   
    OVERLAY=(30:C'ZE')                 
R268A  SORT STATEMENT    : SYNTAX ERROR
shailaja85
 
Posts: 20
Joined: Fri Feb 10, 2012 5:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need help sort

Postby enrico-sorichetti » Thu May 16, 2013 9:26 pm

if You had just searched the forum You would have found the right syntax without asking.
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Need help sort

Postby shailaja85 » Fri May 17, 2013 12:52 am

SORT FIELDS=COPY                 
INREC IFTHEN=(WHEN=(1,3,ZD,EQ,0),
BUILD=(1,39,40:C'ZE'))   


********************************* TOP OF D
111 AAA                                   
222 BBB                                   
000 CCC                                ZE
333 DDD                                   
******************************** BOTTOM OF


How I can write one more condition to come NZ(not eq zero)
shailaja85
 
Posts: 20
Joined: Fri Feb 10, 2012 5:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need help sort

Postby Akatsukami » Fri May 17, 2013 12:59 am

shailaja85 wrote:
SORT FIELDS=COPY                 
INREC IFTHEN=(WHEN=(1,3,ZD,EQ,0),
[code]    BUILD=(1,39,40:C'ZE'))   


********************************* TOP OF D
111 AAA                                   
222 BBB                                   
000 CCC                                ZE
333 DDD                                   
******************************** BOTTOM OF




how i can writre one more condition to come NZ(not eq zero)

You are jesting, yes?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Need help sort

Postby BillyBoyo » Fri May 17, 2013 1:05 am

You can try by just adding another IFTHEN. The IFTHEN is part of the INREC, so you'll need a "continuation" for your existing IFTHEN (a comma after the final closing-bracket).

Another was is with IFTHEN=(WHEN=INIT, which goes first and which is executed for every record. On that you can set to NZ, with the zero condition overwriting the value later.

There is also IFTHEN=(WHEN=NONE, which goes after the IFTHEN=(WHEN=(condition, and is executed for records which have not had a true test against them.

Best thing is to read up in the manual, look at some examples, ensure you understand them, experiment until you do, and then choose one of the above methods.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Need help sort

Postby shailaja85 » Sat May 18, 2013 9:57 am

Hi,

Could you please provide links/documents/examples of IFTHEN=(WHEN=INIT.
many thanks for your anticipated help.
shailaja85
 
Posts: 20
Joined: Fri Feb 10, 2012 5:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Need help sort

Postby enrico-sorichetti » Sat May 18, 2013 10:16 am

cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Need help sort

Postby BillyBoyo » Sat May 18, 2013 12:19 pm

If you see the Search box at the start of your topic, put INIT in there and see what you can find.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Next

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post