View previous topic :: View next topic
|
Author |
Message |
venkat.bmw Warnings : 2 New User
Joined: 05 May 2009 Posts: 21 Location: India
|
|
|
|
I need to find a word in Dataset and then to set Return code for that step. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Can you explain more about your requirement. Do you have only a single record in your input file? If there are multiple records, how do you want to search for the 'word'? Input LRECL,RECFM? |
|
Back to top |
|
|
venkat.bmw Warnings : 2 New User
Joined: 05 May 2009 Posts: 21 Location: India
|
|
|
|
Only two letters eg: 'IT' . If it is present in dataset then I have to change the RC. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
I have to change the RC |
You can't change an RC once issued. And you have nt given enough information for somebody to help you. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
You can use reverse logic and set a return code if the selected literal is not found, and then execute the following steps conditionally upon the result.
The code below will give RC=4 if the literal 333 is not found in the file and will give RC=0 if it is found.
Code: |
//DFSORT EXEC PGM=SORT,PARM='NULLOUT=RC4'
//SYSOUT DD SYSOUT=*
//SORTIN DD *
XXXYYYZZZ
XXXYYYZZZ
XXXYYY222
XXXYYYZZZ
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INCLUDE COND=(1,20,SS,EQ,C'333') |
|
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
expat,
I see a possibility where there are multiple records and the word has to be checked in all the records? May be not. Who knows. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
I was working on the principle that the OP knows what he wants and has said that he wants to find the word in the dataset rather than specific records. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Eagar,
Here's a DFSORT job that will give you a RC=4 if 'IT' is found or a RC=0 if 'IT' is not found. You could use NULLOUT=RC16 to get RC=16 instead of RC=4 if that's what you want. I assumed your input file has RECFM=FB and LRECL=80.
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//SORTOUT DD DUMMY
//SYSIN DD *
OPTION COPY,NULLOUT=RC4
OMIT COND=(1,80,SS,EQ,C'IT')
/*
|
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Brilliant Frank. I should have thought of that as well
I didn't think to use OMIT instead of INCLUDE |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
The question of the possibility of multiple records in the 'dataset' (one or more containing the 'word' and one or more not containing the 'word') has been asked several times but not answered...... |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
CICS Guy,
It was asked twice by the same person.
It was not part of the original requirement, no reason to think it should be a factor, obviously not an issue.
Good solutions to the requirement have been posted. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
I am not so sure Dave, with multiple records, I can see some being omitted while others are outputed, i.e., the 'word' in some and still a zero RC..... |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Apparently, the OP has lost interest. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
The requirement said nothing about an output file.
Quote: |
I need to find a word in Dataset and then to set Return code for that step.
|
Quote: |
Only two letters eg: 'IT' . If it is present in dataset then I have to change the RC.
|
No reference to on a line, or writing the line to a file. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
After 11pm on Friday, i might lose interest too. . .
Have a great weekend!
d |
|
Back to top |
|
|
|