Page 1 of 1

Search a filename in another file Using DFSORT

PostPosted: Fri Mar 29, 2019 8:33 pm
by pinakimishra
Hi,

I have a requirement where I need to pass a name of 50 characters from multiple jobs and I need to search that name in a File A at specific position i.e from 1 to 50. The File A will have 100 filenames. I am going to create 100 jobs which will pass the filename as a parameter and that will be searched in file A. If founf return code will be 0 else return code will be 4. How can I do it through DFSORT?

I can do it through Cobol where I can pass the filename as a PARM parametr through linkage section and search in the File A which will be passed as an i/p file.

Can it be done through Sort?

Thanks
Pinaki

Re: Search a filename in another file Using DFSORT

PostPosted: Fri Mar 29, 2019 8:44 pm
by enrico-sorichetti
unfortunately the description of the requirement is clear as mud

Re: Search a filename in another file Using DFSORT

PostPosted: Sat Mar 30, 2019 3:44 am
by NicC
Sample input and expected output please - in the code tags.

Re: Search a filename in another file Using DFSORT

PostPosted: Mon Apr 01, 2019 8:24 pm
by pinakimishra
Below is the Scenario:

I have a File SMD.Static.DATAFILE which has the below data inside it.
Filename , Indicator
ABC.XYZ.TESTJOAB.DATAFILE, Y
DEF.UVW.TESTJOCD.DATAFILE, N
GHI.REW.TESTJOEF.DATAFILE, Y
IJK.BMC.TESTJOGH.DATAFILE, N
LMN.EQY.TESTJOIJ.DATAFILE, N
OPQ.MFD.TESTJOKL.DATAFILE, Y
RST.SBS.TESTJOMN.DATAFILE, Y


I have 6 test jobs, which will have the above SMD.Static.DATAFILE as an i/p as well as one filename as i/p parameter.
If the i/p parameter is present in the file SMD.Static.DATAFILE and Indicator is Y then Return will be 0.
If the i/p parameter is present in the file SMD.Static.DATAFILE and Indicator is N then Return will be 4.
If the i/p parameter is not present in the file SMD.Static.DATAFILE then Return will be 8.


1. TestJob1 - i/p parameter ABC.XYZ.TESTJOAB.DATAFILE - Expected o/p is Return Code 0
2. TestJob2 - i/p parameter DEF.UVW.TESTJOCD.DATAFILE - Expected o/p is Return Code 4
3. TestJob3 - i/p parameter GHI.REW.TESTJOEF.DATAFILE - Expected o/p is Return Code 0
4. TestJob4 - i/p parameter PQR.ABC.TESTJOYZ.DATAFILE - Expected o/p is Return Code 8
5. TestJob5 - i/p parameter IJK.BMC.TESTJOGH.DATAFILE - Expected o/p is Return Code 4
6. TestJob6 - i/p parameter RST.SBS.TESTJOMN.DATAFILE - Expected o/p is Return Code 0

I can do the above with a Cobol program. But Can I do with a Sort?

In Cobol-

Create 6 jobs where create the below parameters as a PARM from the JCL and accept in Cobol program as Linkage section. Pass the SMD.Static.DATAFILE as an i/p filename. Search the parm parameter in the Static file in Cobol program and set the Return Code.

1. TestJob1 - i/p parameter ABC.XYZ.TESTJOAB.DATAFILE
2. TestJob2 - i/p parameter DEF.UVW.TESTJOCD.DATAFILE
3. TestJob3 - i/p parameter GHI.REW.TESTJOEF.DATAFILE
4. TestJob4 - i/p parameter PQR.ABC.TESTJOYZ.DATAFILE
5. TestJob5 - i/p parameter IJK.BMC.TESTJOGH.DATAFILE
6. TestJob6 - i/p parameter RST.SBS.TESTJOMN.DATAFILE

Re: Search a filename in another file Using DFSORT

PostPosted: Tue Apr 02, 2019 8:41 pm
by pinakimishra
Nicc, Enrico,

Can you please suggest anything based on the Sample i/p and o/p? Please let me know if anything is not clear.
Thanks
Pinaki

Re: Search a filename in another file Using DFSORT

PostPosted: Tue Apr 02, 2019 8:56 pm
by prino
Why are you still wasting our time with clear-as-mud requirements, when you could have written your COBOL program hours ago?

Re: Search a filename in another file Using DFSORT

PostPosted: Wed Apr 03, 2019 4:08 pm
by Garry F Carroll
This can be done using DFSOST's ICETOOL e.g.

EXEC PGM=ICETOOL,PARM='JP1"XXX.REW.TESTJOEF.DATAFILE, Y"'
 


//TOOLIN    DD *                                                      
* ====================================================================
*                                                                    
 COUNT FROM(IN) EMPTY RC4 USING(CTL1)                                
*                                                                    
* ====================================================================
//CTL1CNTL DD *                                                      
*                                                                    
 INCLUDE COND=(1,47,SS,EQ,JP1)                                        
*                                                                    
 

*
This will return cond code 0 if found, cond code 4 if not.

You probably need to revise the INCLUDE statement to cater for positioning/length of the dataset name and the Y/N flag.

Garry.