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: 94
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: 7315

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: 94
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: 7315

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: 94
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: 7315

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: 94
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: 7315

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: 94
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: 7315

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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm


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