Showing posts with label JCL. Show all posts
Showing posts with label JCL. Show all posts

Saturday, November 26, 2011

Generation data groups


This concept is used to keep track of the records in chronological order to create gdg base name must be created by using IBM utility IDCAMS
The basename must be coded in the DEFINE command of sysin dd *



Parameters specified for base:-

LIMIT: this is used to generate no of versions/generations to the base . max no of generations is 255

SCRATCH: used to delete all the generations when limit is reached

NO SCRATCH: used to delete oldest generation when limit is reached

EMPTY: used to uncatilog all the generation when limit is reached

DATEEXPRIED: used to keep the dataset for specified time.

Friday, November 25, 2011

Difference between Static call and dynamic call



 Static call:-
Both main and sub programs and object program will be stored in loadlib.
Can be identified by call peg-id in cobol.

Dynamic call:-
Stored in different loadlib storage spaces
Can be identified by cal ws-peg-id in cobol where ws –peg-id is a dn in wss

Default is static call

IF statements

//jbo001
//step001                exec     pgm=cob001
//step002                exec     pgm=cob002
//chekr1                 if          step002.rc=00 then
//step004                exec     pgm=cob003
//end-rc1                end-if

query: printing a report/ sending a mail to same id the report should send only when the ps from which is going to be is non empty.

COND

This is a keyword parameter this can be coded at job level and activity levels. This will be applicable to all the activities which are coded in the job. Previous step rc will be checked to execute subsequent steps when cond is and coded.
Cond=(return code, relational operator)

Cond=(RC, RO, Stepname).

Return codes are system defined from 0-4095.
Some are               00:successful
                              04:warning
                              08:error
                              12:seviour error
                              16:permanent error.


How to submit jcl from cobol


// job001    job
//step001                exec     pgm=cob002  
//i1             DD      dsn=…….data.input,disp=shr
//o1                        DD      “          “          “          .output,disp=shr.


//job002                 job
//step001                exec     pgm=cob001  
//o1                        DD      dsn=user.source.jcl, disp=shr
//step002                exec     pgm=IEBGENER
//sysut1      DD      dsn=user.sour.jcl, disp=shr
//sysut2      DD      dest=(x,intrdr)


Sending data to mail server


 One pdsà subjects: userid.source.subject(sub001)
One pdsà mailids : userid.source.mailids(mailid001)

Ip address: 3.14.256.33
Printer id = rmt001
Destination is used to route output to a specific destination may/may not be in a remote locatin
To pc: destination/filename
                  Usreid& password
Dest=rmt/ uhhh/nzzz/local/name

To server :
// mailid01             job
//act001                 exec pgm=IEBGENER
//sysut1                  DD      dsn=userid.source.cust.data, disp=shr,
//sysut2                  DD      dsn=”           mailed(mailid01),disp=old.
//”                                                                      subject(subj01), disp=old
//
//sysin                    DD      *
3.45.256.36
/*
//

to printer:
//printer1    job       job output        prid=rmt004
//act001     DD      dsn=userid.source.cust.data, disp=shr,
//systu1      DD      dest=(a, prid)
//

to pc:-

//pssystem  job
//act001                 exec     pgm=FTP
//sysut1                  DD      dsn=user……………….
//output                  DD      *3.23.2365
userid
password
put sysut1+ c:/pc/cust-file
out1
/*
//

Joblib and Steplib


Joblib:-
this is system defined library/ds which can be used to locate the all the object programs which are specified.
Must be coded immediately after the job
Only one joblib must be coded in one job
    Step lib:-
This is system defined dataset which can be used to locate the object peg at activity level
Can be coded any where in the step
Multiple steplibs can be coded in one job

When both are coded steplib overrides  joblib

Instream Procedures & Catalogue Procedures

In stream procedures :-
These are predefined jcl statements within job
This must be coded immediate after the job with proc openrand must be terminated with pend
Max 15 procedures can be defined within the job. And these procedures will be available only for the job when procedures are defined
Parameters can be overridden by stepname .ddname  as dd name
Ex:- sort logic data from one ps to another

Catolg procedures:-
These are the predefined jcl statements outside of the job
This procedures must be coded in members which must be sorted in pds
Can be executed by any job but location of the procedure must specified with poclib ddname immediately after the job
Max 255 procedures can be defined in one job
Symbolic parameters (&) must be used to override the parameres that should be coded prefix with &


Refer back :-
It is used to use the same activity level parameter at one level at another level
This can be used to refer the dataset which are created in the previous steps from subsequent steps
It must be coded with *.stepname.ddname 

Thursday, November 24, 2011

Differences between dummy and temp.



Dummy:-
     1.  this is a null file /do nothing file
     2.  this data set cannot be passed to subsequent steps
  1. this can be used to test the application program
  2. no dcb,space parameters can be coded
  3. any no of dummy ds can be coded in one job
  4. dummy must be coded with dummy parameter
Dsn=nullfile
Temp file:-

1.this file is created by o/s dynamically and deleted after completion of job
2. this can be passed to subsequent steps
3.can be used to test application programs
4.dcb and space parameter can be coded
5.any no of temp ds can be coded in one job
6.this must be coded with prefix && and any user defined name.

Spool commands



c- job cancellation
p – pvs page //p
a-      to release the hold job from the queue
?- to open the states of job
highest job no- latest job no allocated by the o/s automatically depending on the requirement.

Dummy parameter



The files of cobol which are not needed to compiled, because those files are not changed only some files are changed then we have to make them logically unavailable to the compilation. This can be done by Dummy parameter
this is system defied parameter which can be used to create/ delete datasets dynamically by the o/s i.e this data set is available only during the program execution. Dummy must be specified in the DD operand or dsn=nullfile can be used.

use |: to test the cobol program/ to improve program performance at the time of testing . to simplify the testing process.
Any number of dummy parameters can be used as per the requirement.

MERGE:


Merge is to be used then changes : if 3 files to be merged then
// sortin1          DD      dsn
//sotrin2           DD      dsn
//sortin3                                   DD      dsn
//sortout           DD
//sysin  DD      *
merge fields=(startingpos, length, datatype, a/d)
/*
//

Sorting ps



  1. Internal sorting
  2. External sorting : utilities: /SORT/ICETOOL/SYNCSORT/DFSSORT/ICEMEN.

//job001           job(xyz), ‘abc’ class= L MSGclass=x,  MSGLEVEL=(1,1), time=(1,1) reglon=look,typrun= run,  notify=&sysid
//step001                      exec     pgm=IEBGCOPY
//sysin              DD      DSN=user.sour.data.prod.cobol, disp=shr
//sysout                        DD      DSN=user.sour.data.dev.cobol, disp=old
//sortwk01                   DD      space =(cyl,(1,1), rlse), unit =(disk)
//sortwko2                   DD      spaced(b2 (1,1),rlse), unit = disk.
//sysin              DD      *
sort fields=(starting position, length, datatype,{ASC,DES}, HX,a/d)
work files:  while sorting on JCL
identify inputfile, output file &work files

Wednesday, November 23, 2011

IEBCOPY:


 This is a utility supplied by IBM which can be used to copy data from pds to another pds and ps to ps and tape ot ps and COMPRESS
The copy command must be used in sysin dd * to copy members
Select command can be used to copy selected members
Executed command is used to copy all excepted members specified.

note: many ps can be copied to one ps only multiple out ps’s cannot be copied


copying members of one pds to another:

// job001                      job(xyz), ‘abc’ class=A
//step001                      exec     pgm=IEBGCOPY
//sysut1                        DD      DSN=user.sour.data.prod.cobol, disp=shr
//sysut2                        DD      DSN=user.sour.data.dev.cobol, disp=old

IEBGENER


 This is a IBM supplied utility. This is used to copy the data from one sequential file to another. The DD name must b e SYSut1 and SUSut2.
This can also be used to send reports to one or more users mail ids
Can also be used to send reports to printers

Data Set Concatenation :- copy multiple files
The multiple dataset can be concatenated by specifying single DD name and multiple DD operands
Rules:- all datasets file attributes must be same
All data files must be stored in one device
Note : maximum 255 ps,s can be concatenated
Maximum 15 pds’s cam be concatenated

//job001           job(xyz), ‘abc’ class= L MSGclass=x,  MSGLEVEL=(1,1), time=(1,1) reglon=look,type run= run,  notify=&sysid
// act001                      exec     pgm=IEBGENER
//sysut1                        DD      DSN=user.sour.data.i1, disp=shr
//                                 DD      DSN=user.sour.data.i2 disp=old
//                                 DD      DSN=user.sour.data.i3 disp=old
//sysut2                        DD      DSN=user.sour.data.o1, disp=shr
//                                 DD      DSN=user.sour.data.o2 disp=old

//sysout                        DD      sysout=*
//sysprint                      DD      sysput=*
//


note: many ps can be copied to one ps only multiple out ps’s cannot be copied 

IEFBR14



Used to create NILL dataset if creates a new pds/ps
This is a null peg can be used to create/delete physical sequential ddataset dynamically this is the IBM supplied utility
For creating : disp=(new, catlg, delete)
For deleting : disp=(mod, delete, delete)

Copying from ps to ps
1. ispf                                3.3


2. using  cobol & jcl

cobol : cob001
i-o section
file control
select input assign  i1
select out assign  o1

D.D
Fd in1
01 in-rec
fd out1
01 out-rec

P.D
Open input in1
Open output out1

Perform unitl EOF
Read in1
Write out1
End-perform

Close in1
Close out1

JCL:- job001
//job001                 job
//step001    exec     pgm=cob001
//i1                         DD      dsn=user.source.in1.disp=shr
//o1                        DD                               .out1 “      
//sysout                  DD      sysout =*
//sysprint    DD      ””””
//

using IBM utility for copying ps

//job001           job(xyz), ‘abc’ class= L MSGclass=x,  MSGLEVEL=(1,1), time=(1,1) reglon=look,type run= run,  notify=&sysid
// act001                      exec     pgm=IEBGENER
//sysout                        DD      DSN=user.sour.data.ps1, disp=shr
//sysout                        DD      DSN=user.sour.data.ps2 disp=old
//sysout                        DD      sysout=*
//sysprint                      DD      sysput=*

Tuesday, November 22, 2011

Restart:-



Restarting a program which is abounded at some step-step0020 (step0019 are executed already )
RESTART= stepname
When job is submitted first it is going to check for restart.
If temp dataset is created in step0018 after abounding, the temp dataset is refreshed if restart is coded as step0020, it gives error: Temp dataset not available so code RESTART = step0018.

Note :- restart must be always coded in the spool only not in the jcl peg.


DD parameters:-



a)      * :-  positional parameter at DD level used only with SYSIN. To pass data to the cobol programs this is known as instream data any number of records can be passed to the peg.
b)      DSN :-  keyword parameter at DD level.
Ex:-
JCL:-
//job001
//step001          Exec PGM=cob001
// X                  DD      DSN= userid.source.psname1, unit =disk/tape
// AB               DD      DSN=userid.source.psname2, unit =disk/tape

cobol:-
select cust-file assign to X
select cust-file assign to AB



       c) DISP:- used to  identify the mode of the file

DISP :- ( Status, normal, abnormal)

Status:             NEW:- creating the dataset first time
                        OLD:- already created. Accessing the dataset all resources are allocated exclusively. No other user can access until ti is released by the current user. If dataset is not existing this creates.
                        SHR:- the dataset can be accessed by multiple users at a time 
                        MOD:- appending the records to the existing records
Adv:- if dataset is not existing, then MOD is assumed as NEW and writes records to the dataset.

Normal:- all the parameters of normal are active when the job executes successfully
                        Delete:- dataset is deleted when job executes successfully
                        Keep:- it keeps dataset in system. But it doesn’t create any reference in catlg
                        Catlg:- when job terminates successfully it is going to create an index by a referencing name specified in volume label. This keeps dataset
Eg: catlg: volume 4
                        Uncatlg:- it resides in system, but it deletes volume label name form catlg like KEEP.
                        Pass:- to pass dataset to subsequent steps
Abnormal:-     
Delete:- deletes
                        Keep:- keeps in system
                        Catlg:- creates index in catlg
                        Uncatlg:- delete index from catlg

Default : DISP = (new, del, del)

Reusable components in JCL: instream procedure
//job001           job(xyz), ‘abc’ class= L MSGclass=D, MSGLEVEL=(1,1), notify=&sysid
//proc001         PROC à procedure reusable component.
//step001          Exec PGM=cob001
//I1                   DD      DSN=use.input, disp=SHR
//I2                   DD      “          “          “          “= OLD
//                      PEND
//step002         
//
//step100          Exec    PROC001


how to change parameters in procedure(instream)

//job001           job(xyz), ‘abc’ class= L MSGclass=D, MSGLEVEL=(1,1), notify=&sysid
//proc001         PROC à procedure reusable component.
//step001          Exec PGM=cob001
//I1                   DD      DSN=use.input, disp=SHR
//I2                   DD      “          “          “          “= OLD
//                      PEND
//step002         
//
//step100          Exec    PROC001
//step001          DD      DSN=op2        disp=NEW


c)Space:-  this is a keyword parameter in DD operand  can be coded any where after DD operand. This is used to request the storage space for the dataset as per the requirement. The storage space is divided in to primary and secondary for effective storage space utilization.  RLSE parameter is used to release the unused storage space upon the successful /  unsuccessful termination of the job

1) CYLINDERS,BLOCKS, TRACKS AND RECORDS:-different types of storage
2) PRIMARY:- this is the primary which is allocated to the data set while creating
3) SECONDARY: this is additional memory allocated inaddition to the primary memory
4) RLSE:- releases the unused space when peg terminates successfully/unsuccessfully.

SPACE=(TRK,(10,10), RLSE)

a)      Data Control Block:- this contains the following keyword parameters used to specify file attributes.
LRECL:- logical record length =100 fixed length/ variable length.
BLKSIZE:- blocksize (LRECL * 10)
RECFM :- f & fb= fixed length
                     V & vb= variable length
f/fbà LRECL=100.
v/vbàLRECL=maxlength + 4

DSORG : ps/po(pds) (dataset organization)
Po: partition organization
Pds: partitioned dataset
Ps: physical sequent ional file

FBA- fixed block attribute
VBA- variable block attribute

Printer :- 1 byte attribute character (system defined)
0 – line
1 – page
the record length for a printer it should 1+132=133
 to print the data, record length must be 132 +| 1. printer control character
DCB= ( LRECL=133, blksize= 133 * 10,RECFM=fba, DSORG=ps)


Ps/pds created
// job001
//
//step001    Exec                pgm=cob001
//C1                       DD                  DSN=user.souce.data, disp=old
//SYSIN                DD                  *
record 1
……….
…….
………
/*
//

cob001

select cust-file assign to C1
FD cust-file
……………..
……………..

Difference between symbolic & overriding parameters



Symbolic :-
  1. these parameters are used in catlg procedures
  2. these parameters always must be coded prefix with single  &
Overiding:-
  1. overriding parameter is used in instream procedures
  2. stepname must be used as DD name

Activity parameters:-



a) PGM :- this is a positional parameter which must be coded after Exec with one blank. This parameter indicates the name of the program/utility of IBM
b)PARM :-
there are two ways to pass data
method I : using PARM:- this is a keyword parameter at activity level must be coded with Exec operand after PGM parameter. This parameter allows max (100) characters . they consists of predefined text/system defined commands.
The PARM parameter can be used to pass data to user/system defined programs
To receive PARM parameter data, Cobol peg, must be coded with “PROCEDURE DIVISION USING PARAMETERS” option. These parameters must be declared in the linkage section.
JCL:
// step001 exec PGM=cob001, PARM=”2004-10-10 date”(max 100 characters, no separator is coded and size in cobol is only the separator)
Cobol:
DD
Linkage section
01 x pic x(10). 01 y pic x(10)
d division using x,y.
1001-para
display x,y -à date 2004-10-10
stop run
method II :-

SYSIN DD * :-
SYSIN is a system defined DD name and * is the positional parameter off DD. This is used to pass data to Cobol peg/ to pass system defied commands to system defied pegs.
SYSIN DD * INSTREAM data must always be terminated with   /*
Any number of records/data/character must be declared in W S S
One row in SYSIN DD * is equivoque to one accept statement
JCL :
//step001 Exec PGM=cob001
//sysin DD *
[2004-10-10
………….
………….]
/*
//(terminator/end if JCL)

cobol:-
W.S.S
01 ws=data1 pic x(10)
01 ws=data2 pic x(10)

P D
1000-para
            accept ws-data1
            accept ws=data2

 
(* if accept coded in cobol then SYSIN DD * must be coded in JCL
* if SYSIN DD * coded it is not mandatory to coded accept ).


CA 7:- (computer associates )
This tool/package can be used to schedule jobs or can be used to submitting/organizing the jobs or can be used to cancel the jobs.
This is again a setup consists of panels which in thus provides difficult options for submitting the jobs, for organizing the jobs and for cancellation of jobs also.