Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Search string from Multiple datasets

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Rahul_kumar
Warnings : 2

New User


Joined: 24 Jun 2006
Posts: 50

PostPosted: Sat Jan 07, 2012 3:44 pm    Post subject: Search string from Multiple datasets
Reply with quote

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
View user's profile Send private message

Rahul_kumar
Warnings : 2

New User


Joined: 24 Jun 2006
Posts: 50

PostPosted: Sat Jan 07, 2012 3:58 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Sat Jan 07, 2012 5:06 pm    Post subject: Reply to: Search string from Multiple datasets
Reply with quote

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
View user's profile Send private message
Rahul_kumar
Warnings : 2

New User


Joined: 24 Jun 2006
Posts: 50

PostPosted: Sat Jan 07, 2012 5:14 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Sat Jan 07, 2012 5:57 pm    Post subject: Reply to: Search string from Multiple datasets
Reply with quote

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
View user's profile Send private message
Rahul_kumar
Warnings : 2

New User


Joined: 24 Jun 2006
Posts: 50

PostPosted: Sat Jan 07, 2012 6:44 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Sat Jan 07, 2012 7:03 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DUMP DATASETS VS TRACE DATASETS! lind sh CICS 4 Tue Dec 06, 2016 11:31 pm
No new posts Single COPY CICS TS datasets and when... Kyle Carroll CICS 2 Tue Oct 11, 2016 9:47 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm
No new posts How to insert a lengthy string havin... vidyaa DB2 7 Thu Aug 25, 2016 5:20 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us