View previous topic :: View next topic
|
Author |
Message |
raghavmcs
Active User
Joined: 14 Jul 2005 Posts: 105
|
|
|
|
Hi,
I have a file of length 133 and need to search a string 'INDEED' (it may come in any column or row) in that file. If string found, 20th postion to 31st postion of 4th row in the file should be write into output file.
Is it possible do this task using JCL? If yes, please let me know the sample JCL.
And we are using SYNCSORT in our house.
Thanks
Raghav |
|
Back to top |
|
|
TheMFKid
New User
Joined: 20 Nov 2013 Posts: 91 Location: India
|
|
|
|
If you find the string "INDEED" anywhere in your file, you have to capure 20th postion to 31st postion of 4th row in your file. So your output file will contain only one record(extracted from 4th row), if your string is present in file.
I am not sure if the complete requirement can be achieved using Sort.
You can use Search utility in batch PGM=ISRSUPC,PARM=(SRCHCMP,'ANYC') to search for your string in entire file, and based on its return code extract the 4th record using SYNCHSORT. |
|
Back to top |
|
|
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
Why don't you try posting your sample input and expected output which would make it more self-explanatory instead of us trying to guess what you expect your output to be?
Thanks,
Ashwin. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Yes! You can do it using JCL. But...the JCL will only request the OS to execute the program that will actually carry out the task. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
One short step, STOPAFT=4 on the OPTION, and generate a SORT symbol for the value you want. 80-bytes fixed.
Second step, which uses the dataset from above on a //SYMNAMES DD. Include //SYMNOUT DD SYSOUT=whatever so you have a record of the symbol in the sysout.
Have your main step with the required logic, using the symbol which has been generated. |
|
Back to top |
|
|
|