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

How to Initialize a File, given in Input, using JCL ?


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

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Mar 13, 2007 11:47 am
Reply with quote

Hi,

Is there any way in JCL, using which I can initialize a file given in input.

Please don't mix empty-file & Initialized-file with each other.

Let me explain:
I have a file,say HLQ.FIRST.FILE & it contains 10 records.

Now, definition of
Empty File: When I say above file is empty then there is no record in the file.One can say I open the file in edit mode & used D9999 (Deleted all the records).

Initialize File: There is one record in the file in which all Numerical fields are Zeros & Alphanumeric Fields are SPACES.


Actually to Initialize a file One has to know the Layout of the file, but
I was trying to make a general JCL.

Using COBOL I have one Idea, will write two COBOL programs
Say PGM1 & PGM2. PGM2 will be called module.

PGM1 will have the input file to be initialize, will pass the Name of file
HLQ.FIRST.FILE to PGM2(here agian I've to think how to pass the name of Data Set),which will unstring it; based on one of un-stringed string it will search a Data-lib for the copybook for this file. This copybook will be passed to PGM1 in which Output record will be redefined with this copybook.
Now, I have the layout, will initialize the First Group level Variable.Hopefully my file will be initialized.

But it's a bit tedious job, isn't there any way through JCL..?


Please advise.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Tue Mar 13, 2007 1:56 pm
Reply with quote

Quote:
But it's a bit tedious job, isn't there any way through JCL..?

JCL is a Job Control Language, not a programming language. Your mission is totally programmatic.

O.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Mar 13, 2007 6:26 pm
Reply with quote

Yeah, do agree..!!

Actually, using IDCAMS or IEBGENER we can Empty the file given in the input, so I just come up with a thought that ..perhaps there is some way using which I can Initialize a file using JCL, so asked the above query.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Mar 13, 2007 7:20 pm
Reply with quote

The whole concept of having a file with one record that has been "initialized" to zeroes and spaces is really strange.
What use would that "initialized" record be?
A file should contain data, not a single empty record.
Again I ask, what would be its use?
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: Tue Mar 13, 2007 8:50 pm
Reply with quote

Hello,

Do you actually need an "empty" record? Are you trying to ensure that when read, the first read goes to successful end-of-file?

To create an empty file you can do with JCL.

As Bill asked - how would you use a file with one "empty" record?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Mar 13, 2007 9:00 pm
Reply with quote

William,

Yeah, it's a very specific need.

In System/Integration cycle phase of projects (specificaly in first System-Cycle run), I need some control Reports(which are used for Balancing purpose by one third party JOBs) in initialized state.

Say, there are 2 systems sys1 & sys2. I work for sys2 & it's a downstream for sys1.

if I want to do my testing independent of sys1, then for this purpose I copy the required input from production & will manipulate according to my needs instead of getting file from sys1.But if sys1 has to be involved then I need files in initialized status, coz third party JOBs will abend with an empty file. Let me explain:

Lets asuume I work for such a system in which I have to keep track on some amounts & counts. For this, in production, sys1 sends a Control Report (say CRep1) containing some amounts & counts to sys2; now after processing the files form sys1, sys2 will generate one more Control Report (say CRep2), before sending the data to downstreams.
Now the third party JOBs will pick the above two reports CRep1 & CRep2 & will cross-validate whether the amounts/counts passed from sys1 are in sync after sys2..if not an abend is there.


Consider one more situation, in which I say I have two data bases in my system one is pending & other is paid.

PENDING are those who must not be paid in today cycle run.
PAID are those who must be paid in today cycle run.

Now for cycle run, I have to keep CRep2 initialized to make JOBs to feel as if the Pending amounts/counts are zero, coz my motive is to make all the records to go in Paid Data base with out any balancing abend.
Because I want to run my first cycle so there is no logical yesterday from cycle point of view..so nothing must be in pending.

There are some 20-25 such Control Reports for a particular project & when 2 or 3 projects runs parallely then there are enough files to be initialized, so I asked the above query.

I hope ..I could expalin why I need an initilazed file.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Mar 14, 2007 5:43 pm
Reply with quote

Please provide some inputs..!
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top