View previous topic :: View next topic
|
Author |
Message |
rokes
New User
Joined: 09 Jan 2014 Posts: 7 Location: India
|
|
|
|
I am posting this question after having searched a lot across the web.
My requirement is to replace an existing set of logic that was written in STARBAT with any other utility.
Below is the STARBAT step. (My workplace doesn't allow posting the code snap. Sorry about that)
//STEP1 EXEC PGM=STARBAT
//DD01 DD DSN=FILE1,DISP=SHR /* contains a number say 123456789 */
//OUT1 DD DSN=OUTFILE,DISP=NEW,CATLG
//SYSIN DD *
$$DD01 USER MAXENT=9999,
MOVE=(1,80C' ')
MOVE=(1,C'*'),
WRITE OUT1,
*
MOVE=(3,C"IF=(3,EQ,C'PIROOT'),REPL=(45,EQ,X'"),
MOVE=(+0,9,1),
WRITE OUT1
*/
Now at the end of this step. OUTFILE will have the content
IF=(3,EQ,C'PIROOT'),REPL=(45,EQ,X'123456789
So here, with the command MOVE=(+0,9,1) they are some how moving the number 123456789 that is present in FILE1.
I want to know how the same can be achieved through SYNCSORT or anyother utilities.
I have done a lot of search before posting this query. Your suggestion would get me in the right direction.
Thanks in advance. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
what happened when You looked at the SYNCSORT manuals
IFTHEN,BUILD,OVERLAY
search the forum for examples ( gazillions of them )
and meditate if the logic apply to Your requirement
the proper way of asking sort related questions
is to post
input data
expected output
processing logic
from the sample You posted is not easy to understand Your requirement |
|
Back to top |
|
|
rokes
New User
Joined: 09 Jan 2014 Posts: 7 Location: India
|
|
|
|
hi enricho,
I tried Tthe following
SORT FIELDS=COPY
OUTREC FIELDS=(1:C'IF(3,EQ,C'PIROOT'),REPL=(45,EQ,X'''1,9,C''')')
---SORTIN file has 123456789 at 1:9---
Expected output:
IF(3,EQ,C'PIROOT'),REPL=(45,EQ,X'123456789C')
Error:
WER275A - NO KEYWORDS FOUND ON CONTROL STATEMENT
WER275A - NO KEYWORDS FOUND ON CONTROL STATEMENT
version : SYNCSORT FOR Z/OS - 1.4.1.0R |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You get two message, so both your cards are wrong. I suspect that you do not have a blank in the first column of your control cards:
Code: |
SORT FIELDS=COPY
OUTREC BUILD=(C'IF(3,EQ,C'PIROOT'),REPL=(45,EQ,X'''1,9,C''')') |
|
|
Back to top |
|
|
rokes
New User
Joined: 09 Jan 2014 Posts: 7 Location: India
|
|
|
|
Yes.
Good catch. But I still face the below error after correcting it.
Code: |
WER268A OUTREC STATEMENT :SYNTAX ERROR |
[/code] |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You don't have enough single-quotes. C'PIROOT' you want to appear as that value, so you'll need C''PIROOT''.
I'm not going to check the rest. If you want one single-quote in your output, you have to supply it as two consecutive single-quotes, every time. |
|
Back to top |
|
|
rokes
New User
Joined: 09 Jan 2014 Posts: 7 Location: India
|
|
|
|
That is it. Thanks a lot!
Such syntaxes are hardly used in the examples or manuals.
Thanks again Bill! |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
but You can find lots of examples here on the forum |
|
Back to top |
|
|
rokes
New User
Joined: 09 Jan 2014 Posts: 7 Location: India
|
|
|
|
enrico-sorichetti wrote: |
but You can find lots of examples here on the forum |
Excuse me for that.
Bill,
One last doubt.
When we specify the OUTREC FIELDS, can we make a part of the string to be written in the next line in the SORTOUT file.
Actual:
Code: |
IF(3,EQ,C'PIROOT'),REPL=(45,EQ,X'123456789C') |
Expected:
Code: |
IF(3,EQ,C'PIROOT'),
REPL=(45,EQ,X'123456789C') |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
No, you can't even do it with OUTREC BUILD, which is identical to but much more clear than OUTREC FIELDS.
You can, however, do it with OUTFIL BUILD (or OUTFIL OUTREC, which is identical, but much less clear - don't even go there).
Code: |
OUTFIL BUILD=(stufftogoonthefirstline,
/,
stufftogoonthesecondline) |
|
|
Back to top |
|
|
|
|