View previous topic :: View next topic
|
Author |
Message |
kratos86
Active User
Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
Hi,
I have a requirement to check a particular value in the file1 and depending on it write 3 files.
INPUT FILE 1
RECFM - FB
LRECL - 2099
INPUT FILE 2
RECFM - FB
LRECL - 224
O/P files:
a) O/p file1 ---> Copy of file 2
b) O/p file2 ---> Copy of file 2
c) O/P file3----> Only one recrod - Date from file1 starting from position 1 to 8 (DD/MM/YY) and Number of records in file2
Conditions:
1)IF file 1 is having A/B in position 20, create output files
2)If File 1 is empty then the following o/p msg needs to be populated in sysout "File is empty"
3)If File 1 is has no "A/B" in postion 20 - then the following o/p msg needs to be populated in sysout "Invalid file"
In 2nd and 3rd condition it shld also set return code of 12.
If my requirements are not clear, please let me know. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hello,
Do you want this to be done using REXX or JCL + DFSORT or JCL + SYNCSORT or anything else? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I don't understand the significance of the title you gave this?
I don't get how you need two copies of File 2, identical to each other and File 2. Isn't there a possibility of just using File 2 instead of those files?
Is File 1 a single-record file? If so, are you saying you need RC=0 when file contains data and position 20 = A or B, otherwise you need "File is empty" and "Invalid file" respectively, with RC=12? |
|
Back to top |
|
|
kratos86
Active User
Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
Quote: |
Do you want this to be done using REXX or JCL + DFSORT or JCL + SYNCSORT or anything else? |
I am looking for JCL + SYNCSORT.
Quote: |
I don't understand the significance of the title you gave this? |
I never thought this question would arrive. Handling two files is the difficult part here and i thought that would be the perfect heading for this.
Quote: |
I don't get how you need two copies of File 2, identical to each other and File 2. Isn't there a possibility of just using File 2 instead of those files? |
These files are used by other applications and they are altering these files. Just to avoid the risk we are providing them different file names with the same data.
Quote: |
Is File 1 a single-record file? If so, are you saying you need RC=0 when file contains data and position 20 = A or B, otherwise you need "File is empty" and "Invalid file" respectively, with RC=12? |
Yes you are correct, for condition 1 it should provide RC=0 and for other two conditions it should provide RC=12. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
[quote="kratos86"]
Quote: |
[...]
Quote: |
I don't understand the significance of the title you gave this? |
I never thought this question would arrive. Handling two files is the difficult part here and i thought that would be the perfect heading for this.
Quote: |
I don't get how you need two copies of File 2, identical to each other and File 2. Isn't there a possibility of just using File 2 instead of those files? |
These files are used by other applications and they are altering these files. Just to avoid the risk we are providing them different file names with the same data.
Quote: |
Is File 1 a single-record file? If so, are you saying you need RC=0 when file contains data and position 20 = A or B, otherwise you need "File is empty" and "Invalid file" respectively, with RC=12? |
Yes you are correct, for condition 1 it should provide RC=0 and for other two conditions it should provide RC=12. |
If the files are flat files, they are not being altered by anything.
If you really want to stick to two copies of the file:
1) Process the File 1 as per spec
2) If zero RC from 1), produce two identical copies of File 2
I now get your title. The thing is, you're not actually sorting the records together, so the problem doesn't really exist. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Bill Woodger wrote: |
kratos86 wrote: |
These files are used by other applications and they are altering these files. Just to avoid the risk we are providing them different file names with the same data. |
If the files are flat files, they are not being altered by anything. |
But could they not be altered by a program that opens them for update-in-place? One could certainly do this in HLASM and PL/I; I don't know COBOL well enough to say if a COBOL program could do this, although I'd venture to guess that it could. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Akatsukami wrote: |
Bill Woodger wrote: |
kratos86 wrote: |
These files are used by other applications and they are altering these files. Just to avoid the risk we are providing them different file names with the same data. |
If the files are flat files, they are not being altered by anything. |
But could they not be altered by a program that opens them for update-in-place? One could certainly do this in HLASM and PL/I; I don't know COBOL well enough to say if a COBOL program could do this, although I'd venture to guess that it could. |
Well, I've just had a look and it does look easy in Cobol. I've definitely never done it, but now I know it can be done. Thanks Akatsukami, another new thing for the day :-)
Kratos86, if they are updating the files in place gently remind them to back them up first, so they don't have to go back to your system for a re-run. |
|
Back to top |
|
|
|