IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Is it possible in to find a word & set RC co


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
venkat.bmw
Warnings : 2

New User


Joined: 05 May 2009
Posts: 21
Location: India

PostPosted: Fri Jul 23, 2010 1:47 pm
Reply with quote

I need to find a word in Dataset and then to set Return code for that step.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Jul 23, 2010 2:16 pm
Reply with quote

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

New User


Joined: 05 May 2009
Posts: 21
Location: India

PostPosted: Fri Jul 23, 2010 2:55 pm
Reply with quote

Only two letters eg: 'IT' . If it is present in dataset then I have to change the RC.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Jul 23, 2010 3:57 pm
Reply with quote

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

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Jul 23, 2010 4:21 pm
Reply with quote

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

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Jul 23, 2010 4:33 pm
Reply with quote

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. icon_biggrin.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Jul 23, 2010 4:35 pm
Reply with quote

I was working on the principle that the OP knows what he wants icon_eek.gif and has said that he wants to find the word in the dataset rather than specific records.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jul 23, 2010 9:41 pm
Reply with quote

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

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Jul 23, 2010 11:29 pm
Reply with quote

Brilliant Frank. I should have thought of that as well icon_redface.gif

I didn't think to use OMIT instead of INCLUDE
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Jul 23, 2010 11:43 pm
Reply with quote

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

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Sat Jul 24, 2010 12:54 am
Reply with quote

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

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sat Jul 24, 2010 1:07 am
Reply with quote

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

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Jul 24, 2010 1:10 am
Reply with quote

Apparently, the OP has lost interest.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Sat Jul 24, 2010 1:12 am
Reply with quote

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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Jul 24, 2010 1:13 am
Reply with quote

After 11pm on Friday, i might lose interest too. . . icon_smile.gif

Have a great weekend!

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
Search our Forums:

Back to Top