Professional Documents
Culture Documents
used to open a file that contains records which satisfy a specified request.
some of the requests which can be made on this command are: Query select , Key fields ,
Grouping .
To use open query file ,use the following sequence of commands:
1).OVRDBF : Here specify name of the file being override. Override the file being opened
to SHARE(*YES). IF YOU DO NOT USE share ODP,the file will be reopened by the next
program that uses it (the OPNQRYF results will be ignored) .
2).OPNQRYF: issue the open query file command.
3).CALL :invokes the high-level language that will process the selected records.
The Open Query File (OPNQRYF) command opens a file to a set of Database records that
satisfies a database query request. Once opened, the file looks like a database file
opened using the Open a database File (OPNDBF) command, and the records in the file
are the records in the file are accessed by high level language programs that share the
open data path (OPD).
OPNQRYF : command acts as a Filter between the processing program and the Database
Records. It will Create Open Data Pathway to Access (Retrieve) data file.
How the records are accessed for using OPNQRYF?
By creating ODP to access (retrieve) data file.( open data pathway )
Open Data Path : It Connects the Program to a File.
An Open Data Path is built whenever a file is opened by any particular program.
An Open Data Path doesnt contain any records at all .
Q) How can we Select / Omit records through OPNQRYF?
You can Specify Select criteria in OPNQRY file to select a Record.
Data Area Advantages : 1) CL can change the contents of data area while it cannot
change the contents of PF 2) Programs can access many data areas. 2) Data area need
not exist at program creation time3) Data area need not exist at program creation time4)
No DDS requires created using CRTDTAARA command.5) Needs no declaration.
CHGDTAARA DTAARA(lib/data area-name (sub string-starting-position string length))
VALUE(new value).
RTVDTAARA DTAARA(lib/data area-name (sub string-starting-position string length))
RTNVAR(&CL-var-name).
SBMJOB and LDA
When SBMJOB is used to submit batch job, the submitting jobs *LDA is copied to batch
jobs LDA.
LDA is used to : 1) To pass values from one program to another with in a job.
To pass values from a calling program to a batch job.
Once you submit job by using SBMJOB command, You can be able to find the Job
Running in Batch Jobs and as well you can find the same in WRKSBMJOB(you can find
the latest one at the bottom(Shift+F6)). As soon as you submit the Job, the status will be in
JOBQ(waiting to run), While Job running in BATCH the status will be in ACTIVE(currently
in progress), After the Job finished, The status of the Job will be 'OUTQ' So, You can
consider the Job has finished when the status becomes OUTQ. If you want to see the
details of that Job, You can use option 5(Work with), You can see the Job status Attributes
and Job log in detail. Pradeep.
DSPRCDLCK command is used to know whether the record was locked or not .
OPNQRYF : command creates a Sharable Open data path to the file through
which data can be accessed by an HLL program .
OPNQRYF produces an Open Data Path but not an Output file.
OPNQRYF command Selects , Sorts, and process data to an HLL program in a
manner specified by the user at program Runtime . it can even create new
fields and summarizes data and passes it to the HLL program for processing as
well .
Uses : 1) Select a subset of available records 2) Order records by the value of
one or more fields
Functions of OPNQRYF: 1) Dynamic Record Selection 2) Dynamic Keyed
Access Path 3) Dynamic Join Function 4) Unique Key Processing 5) Mapped
field definitions 6) Group and final total processing 7) Optimization Options .
SHARE(*YES) :To allow several programs within a single Job to share
the same Open Data Path to a file , specify SHARE(*YES) on the
OVRDBF command .
We can also specify SHARE(*YES) when a database file is created .in this case ,
the file with share its open data path by default and will not require an override
to do so.
If you dont specify SHARE(*YES) iF YOU DO NOT USE share ODP,the file
will be reopened by the next program that uses it(the OPNQRYF results will be
ignored)
JLF Vs OPNQRYF :
An open data path is created when a file is opened. So data retrieving is so
faster compare to JLF. 2)
Dis Advantage of OPNQRYF : Here you create one more data base file to
store data,but it is not necessary in case of JLF.
Open Options : 1. *ALL 2. *INP 3. *OUT 4. *UPD 5. *DLT
*INP :
Open the file for input. *INP is the only value allowed if join processing or
group processing is requested, if UNIQUEKEY processing is specified, or if
all the fields in the open query file record format specified on the Format
specifications prompt (FORMAT parameter) are for input-only use.
*OUT
Open the file for output. It is the combination of input and update
operations.
POSITION keyword : of the OVRDBF command lets us specify where
processing should start when a file opens .
When an error condition occurs during the execution of a program,an
escape
message(*ESCAPE)is sent to the program.escape
messages identifies the specific error that are occurred.
EXAMPLE:
1.
MONMSG
/*
/*
MONMSG CPF0864 *N RETURN
DIRECTLY GOES TO THE RETURN )
2.
*/
----
(HERE CONTROL
*/
NOTE:
ADDLIBLE- Add Library List Entry
job queue is an object(*JOBQ) where batch jobs wait in line for there
turn at batch processing.u can hold,release or assign higher priorities for
jobs in the JOBQ.
LIBRARY LIST provides the search path to locate the objects specified
in he job.
PGM
DCL
DCL
DCL
RTVJOBA
SNDUSRMSG MSG(&DATE)
SNDUSRMSG MSG(&TIME)
SNDUSRMSG MSG(&USER)
USER(&USER)
ENDPGM
___________
PGM
DCLF
FILE(MINDADB/READPHY) RCDFMT(RECFMT)
DCL
DCL
LOOP:
RCVF
RCDFMT(RECFMT)
MONMSG
CHGVAR
CHGVAR
&SALC )
SNDUSRMSG MSG(&MSG)
GOTO
END:
ENDPGM
CMDLBL(LOOP)