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

Handling two files of different Lrecl


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Mon Jul 11, 2011 1:57 pm
Reply with quote

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

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Mon Jul 11, 2011 2:21 pm
Reply with quote

Hello,
Do you want this to be done using REXX or JCL + DFSORT or JCL + SYNCSORT or anything else?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 11, 2011 2:26 pm
Reply with quote

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

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Mon Jul 11, 2011 2:45 pm
Reply with quote

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?

icon_redface.gif 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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 11, 2011 2:57 pm
Reply with quote

[quote="kratos86"]
Quote:
[...]
Quote:
I don't understand the significance of the title you gave this?

icon_redface.gif 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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Jul 12, 2011 1:45 am
Reply with quote

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 12, 2011 4:12 am
Reply with quote

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
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts VB to FB - Finding LRECL SYNCSORT 4
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
Search our Forums:

Back to Top