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

extracting qalifier from dataset into output file


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

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Thu Jun 27, 2013 4:13 pm
Reply with quote

hi all,


how can we extract dsn qualifier into output file?


say for examples. i have a pds names as below.

Code:
userid.input11.dataset
userid.input12.dataset
userid.input13.dataset
userid.input14.dataset
userid.input15.dataset
userid.input16.dataset
userid.input17.dataset


i want to extract 5th and 6th fields from second qualifier of dataset and write into out file.

from the above example my output should have

Code:
11
12
13
14
15
16
17


regds,
useit
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Jun 27, 2013 4:22 pm
Reply with quote

SORT, REXX, COBOL ............. etc etc
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Jun 27, 2013 4:25 pm
Reply with quote

How do you get the pds names or from where you get the pds names?
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Thu Jun 27, 2013 4:43 pm
Reply with quote

thanks.those pds names are standard and fixed.
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Thu Jun 27, 2013 4:45 pm
Reply with quote

i searched in the forum but i did not get any similar eamples.
i never worked on rexx. if you can tel me any similar examplesusing sort i would be really thankful to you

Regds,
useit
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Jun 27, 2013 4:48 pm
Reply with quote

Useit,

So you need to retrieve the pds names through based on some crieria and then pick only 6th and 7th byte to output file?
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Thu Jun 27, 2013 5:39 pm
Reply with quote

yes pandora,
your understanding is right:). pick only 6th and 7th byte to output file
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Jun 27, 2013 5:42 pm
Reply with quote

Use Rexx using ISPF services to retrieve PDS names and then store the 6th and 7th byte of second qualifier in stem variable
Write the stem variable to output file
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Thu Jun 27, 2013 5:50 pm
Reply with quote

i have never worked on rex. how can this be done using sort? i
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jun 27, 2013 8:14 pm
Reply with quote

Hello,

Show an example of the input file that has the dataset names and explain how this dataset was generated.

Once the file of dataset names has been build, the Sort shoule be a COPY and reformat the output as you want.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Jun 28, 2013 6:22 am
Reply with quote

Hi,

does this help
Code:
//STEP0001 EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//SORTIN   DD *                                     
USERID.INPUT11.DATASET                             
USERID.INPUT12.DATASET                             
USERID.INPUT13.DATASET                             
USERID.INPUT14.DATASET                             
USERID.INPUT15.DATASET                             
USERID.INPUT16.DATASET                             
USERID.INPUT17.DATASET                             
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                                     
  SORT FIELDS=COPY                                 
  INREC PARSE=(%=(ENDAT=C'.'),                     
               %02=(ENDBEFR=C'.',FIXLEN=8)),       
        BUILD=(%02)                                 
 OUTREC BUILD=(6,2)                                 
/*                                                 


Gerry
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Jun 28, 2013 7:05 am
Reply with quote

Gerry,

Do we really need parse here?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Jun 28, 2013 7:19 am
Reply with quote

Call an Assembler sub-program and issue a RDJFCB Macro. The DSN can be found in the first 44-bytes of the JFCB area. Define the DCB with a fake DD name and pass the "real" DD name (from the JCL) to the sub-program as a parameter as well as a 44-byte area which will hold the DSN from the JFCB area, passed back to the caller. Each file needs to be closed to the sub-program (a RDJFCB requirement).

The sub-program's RMODE must be 24. AMODE can be either 24 or 31.

HTH....
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Jun 28, 2013 7:43 am
Reply with quote

Hi Pandora,

possibly not but not all qualifiers will always be the same length.


Gerry
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jun 28, 2013 11:57 am
Reply with quote

For a specific solution with exactly the form of data shown, PARSE would not be needed.

useit has seen enough SORT solutions to be able to do the simple case, so I'm guessing more complexity, so I'd go for PARSE also.

With IFTHEN=WHEN=(INIT the OUTREC would not be needed.

To make things more flexible, enrico's technique of "right justification" would get the last two digits of the 2nd qualifier always in the same position, no matter how long the qualifier. The only "tricky" part would be the length-one qualifier :-)
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top