IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

PARSE Syntax for not fix length word in string.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Piyush Jadhav

New User


Joined: 06 Feb 2014
Posts: 7
Location: India

PostPosted: Thu Mar 07, 2024 9:14 pm
Reply with quote

Hi,

I am trying to get the words in string of line from below input into different variables so that I can search those in next step. I am doing it using PARSE keyword in JCL SORT.

Not getting what I am missing here or any particular syntax would help me in getting this.

My input is (USSTCP is only constant, rest is varying in text and in length as well).

USSTCP BSCUSS6A
USSTCP BSCUSS99 PQRS,PIYUSH
USSTCP BSCUSS34 ABCDE
USSTCP BSCUSS6A HOSTNAME,abcd.xyz.COM

I want output as -

BSCUSS6A
BSCUSS99 PQRS PIYUSH
BSCUSS34 ABCDE
BSCUSS6A HOSTNAME abcd.xyz.COM


I tried various SYSIN DD statements -
OUTFIL PARSE=(%=(ENDAT=C'USSTCP '),
%01=(STARTAFT=C',',ENDBEFR=BLANKS,FIXLEN=8)),

OUTFIL PARSE=(%01=(STARTAFT=C'USSTCP ',FIXLEN=8)),

I tried various PARSE keywords but didn't get luck to sort this out, if anyone help here please.
_________________
Regards,

Piyush. :-)
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1334
Location: Bamberg, Germany

PostPosted: Thu Mar 07, 2024 9:43 pm
Reply with quote

If you seek SORT advice, why posting in JCL & VSAM section of the forum?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1334
Location: Bamberg, Germany

PostPosted: Thu Mar 07, 2024 9:45 pm
Reply with quote

You can simply strip the first part from the record using INREC here.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1334
Location: Bamberg, Germany

PostPosted: Thu Mar 07, 2024 10:29 pm
Reply with quote

Please use the code tags when providing code/data next time. Also provide sample data for input and desired output. RECFM/LRECL of the input and such.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2140
Location: USA

PostPosted: Fri Mar 08, 2024 12:01 am
Reply with quote

Joerg.Findeisen wrote:
If you seek SORT advice, why posting in JCL & VSAM section of the forum?


Quote:
Everything what is not COBOL supposed to be JCL!
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2140
Location: USA

PostPosted: Fri Mar 08, 2024 11:49 pm
Reply with quote

1. First of all, learn how to be polite to your readers:
Piyush Jadhav wrote:
Hi,

I am trying to get the words in string of line from below input into different variables so that I can search those in next step. I am doing it using PARSE keyword in JCL SORT.

Not getting what I am missing here or any particular syntax would help me in getting this.

My input is (USSTCP is only constant, rest is varying in text and in length as well).

Code:
USSTCP BSCUSS6A
USSTCP BSCUSS99 PQRS,PIYUSH
USSTCP BSCUSS34 ABCDE
USSTCP BSCUSS6A HOSTNAME,abcd.xyz.COM


I want output as -

Code:
BSCUSS6A
BSCUSS99 PQRS PIYUSH
BSCUSS34 ABCDE
BSCUSS6A HOSTNAME abcd.xyz.COM


I tried various SYSIN DD statements -
Code:
OUTFIL PARSE=(%=(ENDAT=C'USSTCP '),
              %01=(STARTAFT=C',',ENDBEFR=BLANKS,FIXLEN=8)),

Code:
OUTFIL PARSE=(%01=(STARTAFT=C'USSTCP ',FIXLEN=8)),


I tried various PARSE keywords but didn't get luck to sort this out, if anyone help here please.
_________________
Regards,

Piyush. :-)

When done, then we can continue the "discussion".

2. Also it would be useful to find out: what is the difference between JCL, and SORT!!!

3. You are not using "different SYSIN DD statements", but different "SORT control statements"!!!
Those are "different SYSIN DD statements":
Code:
//SYSIN DD *
//SYSIN DD DUMMY
//SYSIN DD DISP=SHR,DSN=aaa.bbb.ccc
//SYSIN DD DDNAME=ANOTHER

4. What does this mean - "get the words in string of line from below input into different variables" ?
Where are there any variables in your example???
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2140
Location: USA

PostPosted: Sat Mar 09, 2024 10:30 pm
Reply with quote

Discussions do not help when TS is not interested in learning something, including common terminology...

@Piyush: Not clear: how do you plan to fit your "abcd.xyz.COM" value into 8 characters field you are trying to reserve?

Try this:
Code:
 INREC PARSE=(%1=(STARTAT=NONBLANK,
                  ENDBEFR=C',',ENDBEFR=BLANKS,   USE EITHER SEPARATOR
                  FIXLEN=9,     RESERVE 8 + 1 CHARACTER AS FURTHER SEPARATOR
                  REPEAT=10)),  TOTAL 10 FIELDS, ONE TO IGNORE
*      BUILD ALIGNED FIELDS, EXCLUDING #1
       BUILD=(%2,%3,%4,%5,%6,%7,%8,%9,%10)
 SORT FIELDS=COPY
 END
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1334
Location: Bamberg, Germany

PostPosted: Sun Mar 10, 2024 2:30 pm
Reply with quote

What puzzled me was the (not yet seen) second search step. Perhaps it renders the previous need for a parse operation obsolete.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts ICETOOL to SUM String DFSORT/ICETOOL 1
No new posts Mark Previous & next lines when a... DFSORT/ICETOOL 9
No new posts Get RECORD LENGTH, allocated space of... CLIST & REXX 7
No new posts sort to find out the char which repea... Mainframe Interview Questions 10
Search our Forums:

Back to Top