Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Reformatting and adding additional filler lines in syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
Badbeef

New User


Joined: 16 Oct 2006
Posts: 2

PostPosted: Thu Apr 05, 2018 4:45 pm    Post subject: Reformatting and adding additional filler lines in syncsort
Reply with quote

Hi there. Long time lurker first time poster (I think.. its been a while) So lets get to it icon_biggrin.gif

I have two requirements where I need to parse data from a file and then convert it to a different format with additional lines (yes it may be easier with Easytrieve but wondering if I can get away with it using sort).

I would like to show the first one for folks to see what I am going for then show the challenge I am stuck with

INPUT file - one record only
FILETEST101821.txt; otherstuff blah blah blah


My sample sort card - this works
Code:
SORT FIELDS=COPY
OUTFIL OUTREC=(C' SIGNON ESF=YES CASE=YES',80:X,/,
C' SUBMIT PROC=XXXXXXX             -',80:X,/,
C'  &STEP=STEP1                            -',80:X,/,
C'  &FROMDSN=HARD.CODED.FILE1 -',80:X,/,
C'  &TOFILE=',X'7D',C'/hardcoded/directory1/',1,17,
X'7D',80:X,/,                                                           
C' SUBMIT PROC=XXXXXXX                    -',80:X,/,
C'  &STEP=STEP2                           -',80:X,/,
C'  &FROMDSN=HARD.CODED.FILE2        -',80:X,/,
C'  &TOFILE=',X'7D',C'/hardcoded/directory1/CK_',1,17,
X'7D',
C'-',80:X,/,
C' SIGNOFF',80:X)


Note: ---> the X'7D' is ( ' ) in Hexa

Output Results (more or less)
Code:
SIGNON ESF=YES CASE=YES
SUBMIT PROC=XXXXXXX                    -
&STEP=STEP1                           -
&FROMDSN=HARD.CODED.FILE1 -
&TOFILE='/hardcoded/directory1/FILETEST101821.txt'
SUBMIT PROC=XXXXXXX                    -
&STEP=STEP2                           -
&FROMDSN=HARD.CODED.FILE2       -
&TOFILE='/hardcoded/directory1/CK_FILETEST101821.txt'
SIGNOFF


So I am able to just use that one record file and populate the file name in both &TOFILE lines

Challenge

So for the other requirement that I am stuck with:

I need to parse a 4 line record file that contains the source and destination file name for 2 files (the names change but the length of name is fixed) and turn it into the same format as the first challenge.


INPUT FILE2
Code:
PUT 'FILEA.SOURCE.PLACE'  +       
    FILEA.DESTINATION.txt               
PUT 'FILEB.SOURCE.PLACE'  +       
    FILEB.DESTINATION.txt               


Target output

Code:
SIGNON ESF=YES CASE=YES
SUBMIT PROC=XXXXXXX           -
&STEP=STEP1                           -
&FROMDSN=FILEA.SOURCE.PLACE -
&TOFILE='/hardcoded/directory1/FILEA.DESTINATION.txt'
SUBMIT PROC=XXXXXXX                    -
&STEP=STEP2                           -
&FROMDSN=FILEB.SOURCE.PLACE -
&TOFILE='/hardcoded/directory1/FILEB.DESTINATION.txt'
SIGNOFF


So for above I need to put the parsed text in the &FROMDSN and the &TOFILE IS it possible to extract the file names from INPUT FILE 2 and then put it in the format that I need with the additional lines in just one sort step (using multiple OUTREC ??) or do I need to split up into 4 files and then have another sort step do the merge?

Version of syncsort is 2.1.4.0R

Any help would be appreciated icon_smile.gif
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2123
Location: UK

PostPosted: Thu Apr 05, 2018 5:42 pm    Post subject:
Reply with quote

Long-time lurker should know to use the code tags and that they are data sets not files!
Back to top
View user's profile Send private message
Badbeef

New User


Joined: 16 Oct 2006
Posts: 2

PostPosted: Thu Apr 05, 2018 6:02 pm    Post subject:
Reply with quote

Nic Clouston wrote:
Long-time lurker should know to use the code tags and that they are data sets not files!


sadly as I have not had the chance to post never really got the chance to look at how to do the code tags. Could not find em in the Forum FAQ / User Guide section nor on any sticky. May I ask for a link that explains so please?

As for Datasets and not files, sorry force of habit. I keep talking to a bunch of Datastage/ETL folk over here and their definition of a Dataset is different from ours. Then when I talk to the Java /web folk their eyes glaze over when I say Dataset so I just say File icon_biggrin.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2123
Location: UK

PostPosted: Thu Apr 05, 2018 6:50 pm    Post subject:
Reply with quote

Use the full editor - it has buttons to add effects: highlight the text to apply the effect to and click the appropriate button.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2448
Location: @my desk

PostPosted: Thu Apr 05, 2018 6:52 pm    Post subject:
Reply with quote

Badbeef,

One thing you could do is to build a SYMNAMES data set by reading the 'file names data set', creating 4 symbols corresponding each name. Then use it in the next step.
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 388
Location: Maryland

PostPosted: Thu Apr 05, 2018 8:16 pm    Post subject:
Reply with quote

AFAIU a quite flexible approach is required, isn't it?
SYNCSORT is not the best tool for doing this, but it's not a rocket science anyway.

Stage 1: using PARSE, WHEN=GROUP, and BUILD convert the input file
Code:
PUT 'FILEA.SOURCE.PLACE'  +       
    FILEA.DESTINATION.txt               
PUT 'FILEB.SOURCE.PLACE'  +       
    FILEB.DESTINATION.txt               

to its table-like equivalent:
Code:
FILEA.SOURCE.PLACE              FILEA.DESTINATION.txt               
FILEB.SOURCE.PLACE              FILEB.DESTINATION.txt               


Stage 2: Use some kind of a template to define the desired output file structure:
Code:
SIGNON ESF=YES CASE=YES
SUBMIT PROC=XXXXXXX                    -
&STEP=STEP1                           -
&FROMDSN=FILEA.SOURCE.PLACE -
&TOFILE='$$$PARAMETER$$$'
SUBMIT PROC=XXXXXXX                    -
&STEP=STEP2                           -
&FROMDSN=FILEB.SOURCE.PLACE       -
&TOFILE='$$$PARAMETER$$$'
SIGNOFF


Stage 3: Using PARSE, WHEN=GROUP, and BUILD insert the required 'key markers' into a working version of the template:
Code:
SIGNON ESF=YES CASE=YES
SUBMIT PROC=XXXXXXX                    -
&STEP=STEP1                           -
&FROMDSN=FILEA.SOURCE.PLACE -              FILEA.SOURCE.PLACE
&TOFILE='$$$PARAMETER$$$'                  FILEA.SOURCE.PLACE
SUBMIT PROC=XXXXXXX                    -
&STEP=STEP2                           -
&FROMDSN=FILEB.SOURCE.PLACE       -        FILEB.SOURCE.PLACE
&TOFILE='$$$PARAMETER$$$'                  FILEB.SOURCE.PLACE
SIGNOFF


Stage 4: Using JOINKEYS, PARSE, IFTHEN, and BUILD combine the table-like input, and updated template - replacing $$$PARAMETERS$$$ parts with joined column 2 from table-like input.
Code:
SIGNON ESF=YES CASE=YES
SUBMIT PROC=XXXXXXX                    -
&STEP=STEP1                           -
&FROMDSN=FILEA.SOURCE.PLACE -       
&TOFILE='FILEA.DESTINATION.txt'
SUBMIT PROC=XXXXXXX                    -
&STEP=STEP2                           -
&FROMDSN=FILEB.SOURCE.PLACE       -     
&TOFILE='FILEB.DESTINATION.txt'
SIGNOFF



For details on using SORT statements, and parameters, please, RTFM or search this forum.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2064
Location: NY,USA

PostPosted: Thu Apr 05, 2018 9:36 pm    Post subject:
Reply with quote

Code:
PUT 'FILEA.SOURCE.PLACE'  +       
     FILEA.DESTINATION.txt               
 PUT 'FILEB.SOURCE.PLACE'  +       
     FILEB.DESTINATION.txt

-Include only 1-4 = spaces
-Use RESIZE to place two records to each other
FILEA.DESTINATION.txt FILEB.DESTINATION.txt
Use JOINKEYS to Overlay, respective positions from DS1 to DS2.
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 -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts REFORMATTING WITH JFY CLOBBERING OUTP... speermb DFSORT/ICETOOL 12 Thu Nov 08, 2018 7:20 pm
No new posts SYNCSORT keep MIN/MAX record Cloink SYNCSORT 16 Mon Sep 17, 2018 3:00 pm
This topic is locked: you cannot edit posts or make replies. Adding comments in Synsort rajiv rengasamy SYNCSORT 18 Fri Jul 13, 2018 3:21 pm
No new posts write multiple lines in PS file in cobol Balu5491 COBOL Programming 7 Wed Mar 07, 2018 10:27 am
No new posts Receommendations required for adding ... Alan Playford JCL & VSAM 5 Wed Feb 14, 2018 4:01 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us