Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

FINDREP=(INOUT problem

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

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Sat Mar 21, 2015 1:34 am    Post subject: FINDREP=(INOUT problem
Reply with quote

I'm trying to create an Excel comma-delimited file with SyncSort. The data also has commas in it so I needed to add double-quotes around the fields along with the comma. Now the issue I have is the output has no double-quote in col-1, and an extra quote at end.
Any help/suggestions would be appreciated (yes, I've been looking at the SyncSort manuals). Thanks.

Input:
Code:
1111~222~2015-02-28~
9999999999~JONES & ASSOCIATES, DDS, PA~P O BOX 123~~AAAAAAAAAA~

//SYSIN DD *
Code:
   SORT FIELDS=COPY
   OUTFIL FNAMES=SORTOUT,VTOF,OUTREC=(5,3000)
   OUTREC FINDREP=(INOUT=(C'~',C'","', 
                          C'"   ',C'    '))


Sample of what I am getting (no double-quote in col-1, and an extra quote at end):
Code:
1111","2222","2015-02-28","
9999999999","JONES & ASSOCIATES, DDS, PA","P O BOX 123","","AAAAAAAAAA","


Sample of what it should look like:
Code:
"1111","2222","2015-02-28",
"9999999999","JONES & ASSOCIATES, DDS, PA","P O BOX 123","","AAAAAAAAAA",
Back to top
View user's profile Send private message

RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Sat Mar 21, 2015 1:56 am    Post subject: Reply to: FINDREP=(INOUT problem
Reply with quote

Try using INREC FINDREP and then use OUTREC BUILD to do whatever formatting you want.

Something like this:
Code:
//SYSIN DD *                                                         
    SORT FIELDS=COPY                                                 
    OUTFIL FNAMES=SORTOUT,VTOF                                             
    INREC FINDREP=(INOUT=(C'~',C'","',                               
                           C'"   ',C'    '))                         
    OUTREC BUILD=(1:C'"',2:5,3000)                                     
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Sat Mar 21, 2015 3:38 am    Post subject: Reply to: FINDREP=(INOUT problem
Reply with quote

Code:
   SORT FIELDS=COPY
   INREC IFTHEN=(WHEN=INIT,
               FINDREP=(INOUT=(C'~',C'","',))),
         IFTHEN=(WHEN=INIT,
               BUILD=(1,4,C'"',5)),
         IFTHEN=(WHEN=INIT,
               FINDREP=(INOUT=(C'"   ',C'    ')))

   OUTFIL VTOF,OUTREC=(5,3000)


The BUILD takes care of the first problem. You have to insert a character, because there is nothing to change.

Your other problem is that the output from one FINREP change cannot be further changed in the same FINDREP. So you need a second FINDREP.

It doesn't matter in what order you specify them, OUTFIL is always going to be done last. So specify it last anyway.
Back to top
View user's profile Send private message
Gary McDowell

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Wed Mar 25, 2015 2:17 am    Post subject:
Reply with quote

Thanks Bill and RahuG31.

Almost!

Only the last IFTHEN to change the double-quote with a space did not work and I think I know why.
The input is variable-length and the last double-quote has no spaces after it so it's never found.
Input in hex:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
1111~222~2015-02-28~                                             
FFFFAFFFAFFFF6FF6FFA
11111222120150020281
--------------------------------------------------------------------------------
9999999999~JONES & ASSOCIATES, DDS, PA~P O BOX 123~~AAAAAAAAAA~ 
FFFFFFFFFFADDDCE454CEEDCCCECE64CCE64DCAD4D4CDE4FFFAACCCCCCCCCCA
99999999991165520001226391352B0442B0711706026701231111111111111
--------------------------------------------------------------------------------

I tried replacing the last IFTHEN with the following but got the same double-quote at the end:
Code:
  OUTREC IFTHEN=(WHEN=INIT,                       
                 FINDREP=(INOUT=(C'"   ',C'    ')))

  OUTREC FINDREP=(INOUT=(C'"   ',C'    '))


I then tried googling for a way I could change the last input '~' or last output '"'. Nothing yey.
Any suggestions?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Wed Mar 25, 2015 4:30 am    Post subject: Reply to: FINDREP=(INOUT problem
Reply with quote

Your diagnosis is correct.

Sorry, I "tested" it with fixed input :-)

Change this:

Code:

         IFTHEN=(WHEN=INIT,
               FINDREP=(INOUT=(C'"   ',C'    ')))


To this:

Code:

         IFTHEN=(WHEN=INIT,
               OVERLAY=(3005:X)),
         IFTHEN=(WHEN=INIT,
               FINDREP=(INOUT=(C'"   ',C'    '),
                        DO=1))


At the moment you are extending any records shorter than 3000 in length of data on the OUTFIL, and they get padded with space. No problem (since there is no SORT) in doing it in INREC before the second FINDREP. Then there is only one change you need, so put the DO=1 to prevent the FINDREP searching the entire 3000 bytes (for a variable-length record, FINDREP starts at position five and is limited by the record-length in the RDW, which SORT will automatically increase after the OVERLAY).

If there were a SORT involved, you'd do this all in OUTREC, which would be after the SORT is complete, to limit the amount of data sorted.
Back to top
View user's profile Send private message
Gary McDowell

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Wed Mar 25, 2015 5:56 pm    Post subject:
Reply with quote

Perfect! Thank you Bill. I like how that DO=1 works.

Are there any links/books you would recommend for SYNCSORTs?

Thanks again.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Wed Mar 25, 2015 6:55 pm    Post subject: Reply to: FINDREP=(INOUT problem
Reply with quote

SyncSort documentation is proprietary, but you can get copies easily if your site is licensed to use the product.

There is no SyncTool documentation. According to Dave Porcelan, SyncSort Support suggest using the DFSORT documentation for ICETOOL.

There are various DFSORT papers which will be useful and largely work on SyncSort, but be careful not to miss out on SyncSort-only stuff.

There is a new SyncSort available, 2.1. There are some papers at syncsort.com, but I've not looked at them yet.
Back to top
View user's profile Send private message
Gary McDowell

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Wed Mar 25, 2015 9:38 pm    Post subject: Re: Reply to: FINDREP=(INOUT problem
Reply with quote

Bill Woodger wrote:
SyncSort documentation is proprietary, but you can get copies easily if your site is licensed to use the product.

There is no SyncTool documentation. According to Dave Porcelan, SyncSort Support suggest using the DFSORT documentation for ICETOOL.

There are various DFSORT papers which will be useful and largely work on SyncSort, but be careful not to miss out on SyncSort-only stuff.

There is a new SyncSort available, 2.1. There are some papers at syncsort.com, but I've not looked at them yet.

I'll take your suggestions. Thanks Bill.
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 Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm
No new posts Problem with GETMAIN command amitc23 CICS 6 Thu Sep 01, 2016 1:01 pm
No new posts TXT2PDF problem - printing @ in PDF vipul65 All Other Mainframe Topics 9 Thu Aug 25, 2016 12:48 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us