View previous topic :: View next topic
|
Author |
Message |
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
SORT, REXX, COBOL ............. etc etc |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
How do you get the pds names or from where you get the pds names? |
|
Back to top |
|
|
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
thanks.those pds names are standard and fixed. |
|
Back to top |
|
|
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
yes pandora,
your understanding is right:). pick only 6th and 7th byte to output file |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
i have never worked on rex. how can this be done using sort? i |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Gerry,
Do we really need parse here? |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Pandora,
possibly not but not all qualifiers will always be the same length.
Gerry |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|