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
 

 

Syncsort 1.4.2 - Variable file - Ignore last 2 bytes

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

New User


Joined: 07 Apr 2010
Posts: 93
Location: Bangalore, India

PostPosted: Fri May 22, 2015 9:45 pm    Post subject: Syncsort 1.4.2 - Variable file - Ignore last 2 bytes
Reply with quote

Hi all,

I am working on a requirement where in a variable - CSV mainframe DSN, I have last 2 bytes as a Comma (,) and a character - A,U,D.

I would like to ignore the comma and any characters that appear at the end.

Is it possible to achieve it thru Syncsort?

Sample Records:
Code:
UNKNOWN,DNAINGDEG,U   
,UNKNOWN, ,U 
UNKNOWN, ,A


Expected Output
Code:
UNKNOWN,DNAINGDEG   
,UNKNOWN,
UNKNOWN,
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Sat May 23, 2015 1:13 am    Post subject: Reply to: Syncsort 1.4.2 - Variable file - Ignore last 2 bytes
Reply with quote

Yes. If you shift to the right to the maximum length, then blank out the last two characters and shift to the left. Look at JFY.
Back to top
View user's profile Send private message
TS70363

New User


Joined: 07 Apr 2010
Posts: 93
Location: Bangalore, India

PostPosted: Sat May 23, 2015 2:17 am    Post subject: Reply to: Syncsort 1.4.2 - Variable file - Ignore last 2 bytes
Reply with quote

Thanks, Bill

Your post helps.
Just an add on to my requirement, I need to filter my output files based on the last character - if it is A,U it should go to ADD output file and if it is D, it should go to DELETE file

Please correct my understanding, if on a wrong track:
1) Use INREC IFTHEN WHEN INIT - JFY=RIGHT, LENGTH = MAX LENGTH
2) OUTFIL FILES=ADD,INCLUDE=(MAX-LENGTH,1,CH,EQ,L(C'A',C'U')),
IFTHEN WHEN INIT, BUILD=(1, MAXLENGTH - 2, JFY=LEFT),
3) OUTFIL FILES=DEL,INCLUDE=(MAX-LENGTH,1,CH,EQ,L(C'D')),
IFTHEN WHEN INIT, BUILD=(1, MAXLENGTH - 2, JFY=LEFT)
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Sat May 23, 2015 4:28 am    Post subject: Reply to: Syncsort 1.4.2 - Variable file - Ignore last 2 bytes
Reply with quote

If you have fixed-length records, that'll be close, but you BUILD not be needed.
Back to top
View user's profile Send private message
TS70363

New User


Joined: 07 Apr 2010
Posts: 93
Location: Bangalore, India

PostPosted: Sun May 24, 2015 1:49 am    Post subject: Reply to: Syncsort 1.4.2 - Variable file - Ignore last 2 bytes
Reply with quote

Hi,
As I am using VB input records, the sort fails with INREC SHORT RECORD
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Sun May 24, 2015 2:57 am    Post subject: Reply to: Syncsort 1.4.2 - Variable file - Ignore last 2 bytes
Reply with quote

You'll need to post what you are running, easiest is to past the full sysout for the failing step.
Back to top
View user's profile Send private message
TS70363

New User


Joined: 07 Apr 2010
Posts: 93
Location: Bangalore, India

PostPosted: Sun May 24, 2015 3:34 am    Post subject: Reply to: Syncsort 1.4.2 - Variable file - Ignore last 2 bytes
Reply with quote

RECFM=VB
LRECL=50

Code:
SORT FIELDS=COPY
INREC FIELDS=(1,4,5,46,JFY=(SHIFT=RIGHT,LENGTH=46))
OUTFIL FILES=OUT,INCLUDE=(50,1,CH,EQ,C'A'),
  OUTREC=(1,4,5,46,JFY=(VL)),FTOV


SYSOUT:
Code:
WER244A  INREC - SHORT RECORD
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Sun May 24, 2015 3:50 am    Post subject: Reply to: Syncsort 1.4.2 - Variable file - Ignore last 2 bytes
Reply with quote

Code:
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,
               OVERLAY=(51:X)),
           IFTHEN=(WHEN=INIT,
               OVERLAY=(5,46,JFY=(SHIFT=RIGHT,LENGTH=46))
OUTFIL FILES=OUT,INCLUDE=(50,1,CH,EQ,C'A'),
  BUILD=(1,4,5,46,JFY=(VL)),FTOV


I'm not sure what the VL means. Why are you trying to use FTOV? You haven't truncated the last two bytes in the OUTFIL, I thought you needed that.
Back to top
View user's profile Send private message
TS70363

New User


Joined: 07 Apr 2010
Posts: 93
Location: Bangalore, India

PostPosted: Sun May 24, 2015 11:47 am    Post subject: Reply to: Syncsort 1.4.2 - Variable file - Ignore last 2 bytes
Reply with quote

Thanks Bill. Yes I do want to truncate the last 2 bytes. As this is just a test version of the Sort Card, I have retained it. I will reduce the length in BUILD statement bt 2 bytes. TA.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Mon May 25, 2015 12:49 pm    Post subject: Reply to: Syncsort 1.4.2 - Variable file - Ignore last 2 bytes
Reply with quote

Code:
 SORT FIELDS=COPY
 INREC IFTHEN=(WHEN=INIT,
                OVERLAY=(51:X)),
            IFTHEN=(WHEN=INIT,
                BUILD=(1,4,5,46,JFY=(SHIFT=RIGHT,LENGTH=46))
 OUTFIL FILES=OUT,INCLUDE=(50,1,CH,EQ,C'A'),
   BUILD=(1,4,5,46,JFY=(SHIFT=LEFT,LENGTH=46)),
          VLTRIM


OK, I've discovered what VL means (a variable-length field with trailing blanks dropped) and that it only works on OUTFIL with FTOV.

That doesn't mean you just add FTOV onto OUTFIL to make the VL work. FTOV converts Fixed-length-record TO Variable-length-records. So you'd need to have fixed-length input you wanted as variable-length output. So you can't use FTOV here, so you can't use VL on JFY. In this case it will make the JFY not do what you want, even if it did "work".

When you want to drop the last two, use 5,44 in the final BUILD.
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 syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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