Posted: Sat Jul 28, 2007 12:02 pm Post subject: How to Initialize a File, given in Input, using JCL ?
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..?
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Sat Jul 28, 2007 12:43 pm Post subject:
to automate this (IMUO useless) task take a look at SYMNAMES in DFSORT. write a REXX or COBOL or ASM module to read copybooks and generate SYMNAMES control cards, putting each group of control cards for each copybook in a separate PDS member and use that member as a DSN for the SYSNAMES DD statement, then you can generate initialized files to your heart's content. _________________ Dick Brenholtz
American living in Varel, Germany
Joined: 01 Mar 2007 Posts: 475 Topics: 9 Location: Welsh Wales
Posted: Sat Jul 28, 2007 3:50 pm Post subject:
If it's a VSAM KSDS, then I have some REXX to load high and low HEX key values if the file has no other records. _________________ If it's true that we are here to help others,
then what exactly are the others here for ?
Why would you want to load a zero/blank record into a file?What purpose would it accomplish?
Hi,
In my system I've some control-files(QSAM files), which keep track on the amount & counts of logical-yesterdays' business. In First system-cycle of any project, I need to start from these files in such a way as if there was no yesterday, for this I initialize these files maually & this is what I want to automate.
I hope you got it.
dbzTHEdinosauer wrote:
(IMUO useless)
What is IMUO ?
expat wrote:
If it's a VSAM KSDS, then I have some REXX to load high and low HEX key values if the file has no other records
No I'm talking about QSAM files. Still, if you can post the code, may be it'll direct me to write a code for my requirement. _________________ Regards,
Anuj
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Mon Jul 30, 2007 5:58 am Post subject:
anuj_model,
IMUO In My Unhumble Opinion as apposed to IMHO In My Humble Opinion.
What you are doing is avoiding writing first time code - empty file input.
Most control-files are either DB2 or VSAM - which allows for keyed I-O processing as apposed to Father-Son processing (QSAM). Admittedly, the VSAM must be initialialized, but the DB2 can be empty.
How many different files, record formats do you have?
again, if you have many, then write a COBOL pgm (or REXX) that has as input any copybook. Your program would then parse the copybook, extracting elementary items (those with PIC clauses) as apposed to group items (no PIC clauses) taking care to ignore elements that are within REDEFINES clauses. Generate the SYMNAMES control cards and output these to a PDS member. This PDS member would be used as input to a DFSORT step which would generate the one (1) record initialized QSAM file. This process could also be used to load a VSAM file with an initialized record.
That way you would have 1 program and one DFSORT JCL where you would only need to modify the pgm INPUT and OUTPUT DSN, and the DFSORT SYMNAMES, BUILD control cards and OUTPUT DSN - the INPUT would be DUMMY.
If you have less than 10 of these copybooks/files, I would do it by hand.
The SYSNAMES generation pgm could also be written in Visual Basic, C, C++,C#,J# or JAVA on the PC or C,C++ on the mainframe.
modified by dbz to correct spelling of SYMNAME _________________ Dick Brenholtz
American living in Varel, Germany
In my system I've some control-files(QSAM files), which keep track on the amount & counts of logical-yesterdays' business. In First system-cycle of any project, I need to start from these files in such a way as if there was no yesterday, for this I initialize these files maually & this is what I want to automate.
I hope you got it.
Nope, sorry, why is an blank&zero record better than an empty file (one with an eof) created by a simple utility?
Nope, sorry, why is an blank&zero record better than an empty file (one with an eof) created by a simple utility?
Hi,
In baseline version of one of the development program I've the following code, for one of the input-file, say IN-FILE :
Code:
READ IN-FILE
AT END MOVE 'Y' TO EOF-INFILE-SW.
IF EOF-INFILE
DISPLAY ' PROGRAM PGM1 ABEND'
DISPLAY ' IN-FILE VERIFICATION FILE EMPTY '
MOVE +4006 TO ABDCODE
RETURN-CODE
PERFORM 9999-ABEND
END-IF.
If I provide IN-FILE as empty, with proper EOF marker & SMS managed file, then above code will issue a user abend, which I don't want in the very first batch-cycle of System/Integration Testing.
I hope you got my point. _________________ Regards,
Anuj
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Tue Jul 31, 2007 2:45 am Post subject:
anuj_model,
we got the point many posts ago. Might I suggest the following:
Since you always want to have a non-empty file, instead of going thru the trouble of pre-initializing all the different input-files, instead load each file with a record that says 'CYCLE-START' in the first 11 chars of any and all cyclic files. You could use DFSORT to generate all these files. Yes, you would have to change a little code in your modules to interrogate the first 11 bytes and determine that this is a cycle start indicator, INITIALIZE INPUT-RECORD-AREA-DEFINITION and then continue processing. The biggest problem with your methodology is that you have to spend too much time insuring that your pre-initialized files are correctly initialized in order to avoid S0C7's etc.... That way you could automate your pre-initialization without it being too complicated. _________________ Dick Brenholtz
American living in Varel, Germany
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Tue Jul 31, 2007 3:05 am Post subject:
if you have to change the layout of your IN-FILE and you used the pre-initialized (with zeros/spaces) you would have to change your pre-initialize jobs also.
whereas if you used a COMP IN-FILE-RECORD(1:11) to 'CYCLE-START', you would not have to change anything......... _________________ Dick Brenholtz
American living in Varel, Germany
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum