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.
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.
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.
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 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...