View previous topic :: View next topic
|
Author |
Message |
Rahul_kumar Warnings : 2 New User
Joined: 24 Jun 2006 Posts: 50
|
|
|
|
Hi,
Error previous posts of requirement removed.
I have a requirement for searching a string from multiple PDS and write the DDNAME to a output file.The string is constant but the position of the DDNAME is not constant.
Each Input file contains one record only and DDNAME starts and ends with a char '(' and ')'.The data in the input files are as below :
Input datasets:
I/P FILE 1 : THE DATA in the Customer dataset (DDCUS) is successfully written
I/P FILE 2 :THE DATA in the account dataset (DDACC) is successfully written
I/P FILE 1 : THE DATA in the standing order dataset (DDSO) is not written
I/P FILE 2 :THE DATA in the direct Debit dataset (DDDIRD) is successfully written
Output Dataset :
DDCUS
DDACC
DDDIRD
In the first step of the Sort JCL I have merged all the input datasets into a single dataset
In the second step the below sort is used to search the string 'is successfully written' from the merge dataset.But in this case the complete record is being written to the o/p file as I have specified SORT FIELDS=COPY.
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,80,SS,EQ,C'is successfully written')
Can anyone suggest any modification so that only the DDNAME is selected to be written to the output dataset.
ICETOOL can also be used in our application.
Thanks in advance! |
|
Back to top |
|
|
Rahul_kumar Warnings : 2 New User
Joined: 24 Jun 2006 Posts: 50
|
|
|
|
Hi,
Reposting the requirement again.....
I have a requirement for searching a string from multiple PDS having a fixed length of 80 bytes and write only the DDNAME specified in the input record to a output file for the condition that the string ='is successfully written'.The string is constant in all the input files but the position of the DDNAME is not constant.
Each Input file contains one record only and DDNAME starts and ends with '(' and ')' resp.The data in the input files are as below :
Input datasets:
I/P FILE 1 : THE DATA in the Customer dataset (DDCUS) is successfully written
I/P FILE 2 :THE DATA in the account dataset (DDACC) is successfully written
I/P FILE 3 : THE DATA in the standing order dataset (DDSO) is not written
I/P FILE 4 :THE DATA in the direct Debit dataset (DDDIRD) is successfully written
Output Dataset :
DDCUS
DDACC
DDDIRD
In the first step of the Sort JCL;I have merged all the input datasets into a single dataset
In the second step the below sort is used to search the string 'is successfully written' from the merge dataset.But in this case the complete record is being written to the o/p file as I have specified SORT FIELDS=COPY whereas I need only the DDNAME to be written to the output file.
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,80,SS,EQ,C'is successfully written')
Can anyone suggest any modification so that only the DDNAME is selected to be written to the output dataset.
ICETOOL can also be used in our application.
Thanks in advance! |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
This is an example of PARSE which you can use to extract your ddname from within the brackets/parentheses.
Code: |
//STEPDDNM EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
THE DATA IN THE CUSTOMER DATASET (DDCUS) IS SUCCESSFULLY WRITTEN
THE DATA IN THE ACCOUNT DATASET (DDACC) IS SUCCESSFULLY WRITTEN
THE DATA IN THE STANDING ORDER DATASET (DDSO) IS NOT WRITTEN
THE DATA IN THE DIRECT DEBIT DATASET (DDDIRD) IS SUCCESSFULLY RITTEN
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTREC PARSE=(%01=(STARTAFT=C'(',ENDBEFR=C')',FIXLEN=8)),
BUILD=(%01)
|
Output is:
Code: |
DDCUS
DDACC
DDSO
DDDIRD
|
You'lll need to include it with your other code for the selection to reduce it to the three ddnames you want. |
|
Back to top |
|
|
Rahul_kumar Warnings : 2 New User
Joined: 24 Jun 2006 Posts: 50
|
|
|
|
Hi Bill,
Many Thanks!
Can you also pls explain the FIXLEN = 8 ,is it the Output file record length?
The length of the DDNAME varies in my case. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
It is the output length. A fixed length is required for the PARSEd field The parse will take the data between the brackets/parentheses, however long that is, and put it into an eight-byte field, with a trailing "pad" if necessary, which defaults to blank. If the field was longer than eight, in this example, the field would be truncated. A DDNAME has a maximum length of eight, so all will fit in. If you need to include data that is just the length of the actual length of data which is extracted by the PARSE, you can "squeeze" (SQZ) the parsed field.
If you run it like this:
Code: |
OPTION COPY
OUTREC PARSE=(%01=(STARTAFT=C'(',ENDBEFR=C')',FIXLEN=8)),
BUILD=(C'>',%01,C'<')
|
You can see what the FIXLEN has done. If you squeeze it as well, the blanks will disappear. |
|
Back to top |
|
|
Rahul_kumar Warnings : 2 New User
Joined: 24 Jun 2006 Posts: 50
|
|
|
|
Tried it,it's working!!
The formatting of the o/p also seems good
Output Dataset :
<DDCUS >
Many Thanks!
One more help,now if I want to write the datasets which are not written i.e. for the string 'is not written' in another output dataset.
Actually my requirement is that the O/P should be :
Successful Files :
DDCUS
DDACC
DDDIRD
Unsuccessful Files
DDSO
So, for unsuccessful msg I can include another sort step similar to the success sort step to get DDSO as the output .
I can define 2 PDS having static succussful and unsuccessful messages.
Then I can write a merge step to combine the output of all the 4 output files
i.e.
O/P File1 : Successful Files :
O/P File2 :
DDCUS
DDACC
DDDIRD
O/P File3 : UnSuccessful Files :
O/P File4 :
DDSO
so,the merged dataset will have the output as :
Successful Files :
DDCUS
DDACC
DDDIRD
Unsuccessful Files
DDSO
Please let me know if this approach is correct,i.e. 4 steps are required in all
Step 1: merge all the I/p datasets
Step 2:writes succ O/P file
STep 3: writes unsucc O/P files
Step 4: merges all 4 datasets |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If you look at OUTFIL you'll see that it is possibile, on condition, to write to more than one output dataset from the data once it is sorted, so you don't have to have one step for successful, one for unsuccessful, unless you choose to do it in two steps for reasons extraneous to the process (site standards, for instance).
Your pre-"merging" I don't really understand, you haven't shown how you are doing it, or indeed if it is actual MERGEing in the SORT sense, or just sticking data together somehow. It would be possible to concatenate a number of datasets on SORTIN, but I don't know if that would be sufficient to remove you first step.
The post-merging I have not the first idea about. What would you be "merging"? You want to produce seperate files, earlier... |
|
Back to top |
|
|
|