IMSDB - COBOL
Program with explanation
Program
Identification Division.
Program-ID. BATCOBOL.
Environment Division.
Data Division.
Working-Storage Section.
01 Func-Codes.
05 Func-GU Picture XXXX Value 'GU '.
05 Func-GHU Picture XXXX Value 'GHU '.
05 Func-GN Picture XXXX Value 'GHN '.
05 Func-GHN Picture XXXX Value 'GHN '.
05 Func-GNP Picture XXXX Value 'GNP '.
05 Func-GHNP Picture XXXX Value 'GHNP'.
05 Func-REPL Picture XXXX Value 'REPL'.
05 Func-ISRT Picture XXXX Value 'ISRT'.
05 Func-DLET Picture XXXX Value 'DLET'.
05 Parmcount Picture S9(5) Value +4 Comp-5.
Program
• This is same as regular cobol program. We
have defined function codes – 4 bytes
Program
01 Unqual-SSA.
05 Seg-Name Picture X(08) Value ' '.
05 Filler Picture X Value ' '.
01 Qual-SSA-Mast.
05 Seg-Name-M Picture X(08) Value 'ROOTMast'.
05 Begin-Paren-M Picture X Value '('.
05 Key-Name-M Picture X(08) Value 'KeyMast '.
05 Kel-Oper-M Picture X(05) Value ' ='.
05 Key-Value-M Picture X(06) Value 'VVVVVV'.
05 End-Paren-M Picture X Value ')'.
01 Qual-SSA-Det.
05 Seg-Name-D Picture X(08) Value 'ROOTDET '.
05 Begin-Paren-D Picture X Value '('.
05 Key-Name-D Picture X(08) Value 'KEYDET '.
05 Rel-Oper-D Picture X(05) Value ' ='.
05 Key-Value-D Picture X(06) Value 'VVVVVV'.
05 End-Paren-D Picture X Value ')'.
01 Det-Seg-In.
05 Data1 Picture X.
05 Data2 Picture X.
01 Mast-Seg-In.
05 Data1 Picture X.
05 Data2 Picture X.
Program
• In the working storage section we need to
define SSA – both qualified and non-qualified.
Program
linkage section.
01 IO-PCB.
05 Filler Picture X(10).
05 IO-Status-Code Picture XX.
05 Filler Picture X(20).
01 DB-PCB-Mast.
05 Mast-Dbd-Name Picture X(8).
05 Mast-Seg-Level Picture XX.
05 Mast-Status-Code Picture XX.
05 Mast-Proc-Opt Picture XXXX.
05 Filler Picture S9(5) Comp-5.
05 Mast-Seg-Name Picture X(8).
05 Mast-Len-KFB Picture S9(5) Comp-5.
05 Mast-Nu-Senseg Picture S9(5) Comp-5.
05 Mast-Key-FB Picture X(256).
01 DB-PCB-Detail.
05 Det-Dbd-Name Picture X(8).
05 Det-Seg-Level Picture XX.
05 Det-Status-Code Picture XX.
05 Det-Proc-Opt Picture XXXX.
05 Filler Picture S9(5) Comp-5.
05 Det-Seg-Name Picture X(8).
05 Det-Len-KFB Picture S9(5) Comp-5.
05 Det-Nu-Senseg Picture S9(5) Comp-5.
05 Det-Key-FB Picture X(256).
Program
• In the linkage section we need to give IO-
PCB,DB-PCB,GSAM-PCB definitions.
Program
Procedure Division using IO-PCB DB-PCB-Mast DB-PCB-Detail.
Call 'CBLTDLI' using Func-GU DB-PCB-Detail
Det-seg-in Qual-SSA-Det.
.
.
Call 'CBLTDLI' using Parmcount Func-ghu DB-PCB-Mast
Mast-seg-in Qual-SSA-Mast.
.
.
Call 'CBLTDLI' using Func-GHN DB-PCB-Mast
Mast-seg-in.
.
.
Call 'CBLTDLI' using Func-REPL DB-PCB-Mast
Mast-seg-in.
.
.
Goback.
Program
• ENTRY 'DLITCBL' using PCB-MASK – This is to
be given only in main program in procedure
division. Not needed in sub-program
• All PCBs must be defined the order they
defined in PSB
• Why batch program needed IO-PCB with
CMPAT=YES => to make system service calls
Program
• The calls are with SSA both qualified and un-
qualified.
Thank You

IMSDB-COBOL PROGRAM EXPLANATION

  • 1.
    IMSDB - COBOL Programwith explanation
  • 2.
    Program Identification Division. Program-ID. BATCOBOL. EnvironmentDivision. Data Division. Working-Storage Section. 01 Func-Codes. 05 Func-GU Picture XXXX Value 'GU '. 05 Func-GHU Picture XXXX Value 'GHU '. 05 Func-GN Picture XXXX Value 'GHN '. 05 Func-GHN Picture XXXX Value 'GHN '. 05 Func-GNP Picture XXXX Value 'GNP '. 05 Func-GHNP Picture XXXX Value 'GHNP'. 05 Func-REPL Picture XXXX Value 'REPL'. 05 Func-ISRT Picture XXXX Value 'ISRT'. 05 Func-DLET Picture XXXX Value 'DLET'. 05 Parmcount Picture S9(5) Value +4 Comp-5.
  • 3.
    Program • This issame as regular cobol program. We have defined function codes – 4 bytes
  • 4.
    Program 01 Unqual-SSA. 05 Seg-NamePicture X(08) Value ' '. 05 Filler Picture X Value ' '. 01 Qual-SSA-Mast. 05 Seg-Name-M Picture X(08) Value 'ROOTMast'. 05 Begin-Paren-M Picture X Value '('. 05 Key-Name-M Picture X(08) Value 'KeyMast '. 05 Kel-Oper-M Picture X(05) Value ' ='. 05 Key-Value-M Picture X(06) Value 'VVVVVV'. 05 End-Paren-M Picture X Value ')'. 01 Qual-SSA-Det. 05 Seg-Name-D Picture X(08) Value 'ROOTDET '. 05 Begin-Paren-D Picture X Value '('. 05 Key-Name-D Picture X(08) Value 'KEYDET '. 05 Rel-Oper-D Picture X(05) Value ' ='. 05 Key-Value-D Picture X(06) Value 'VVVVVV'. 05 End-Paren-D Picture X Value ')'. 01 Det-Seg-In. 05 Data1 Picture X. 05 Data2 Picture X. 01 Mast-Seg-In. 05 Data1 Picture X. 05 Data2 Picture X.
  • 5.
    Program • In theworking storage section we need to define SSA – both qualified and non-qualified.
  • 6.
    Program linkage section. 01 IO-PCB. 05Filler Picture X(10). 05 IO-Status-Code Picture XX. 05 Filler Picture X(20). 01 DB-PCB-Mast. 05 Mast-Dbd-Name Picture X(8). 05 Mast-Seg-Level Picture XX. 05 Mast-Status-Code Picture XX. 05 Mast-Proc-Opt Picture XXXX. 05 Filler Picture S9(5) Comp-5. 05 Mast-Seg-Name Picture X(8). 05 Mast-Len-KFB Picture S9(5) Comp-5. 05 Mast-Nu-Senseg Picture S9(5) Comp-5. 05 Mast-Key-FB Picture X(256). 01 DB-PCB-Detail. 05 Det-Dbd-Name Picture X(8). 05 Det-Seg-Level Picture XX. 05 Det-Status-Code Picture XX. 05 Det-Proc-Opt Picture XXXX. 05 Filler Picture S9(5) Comp-5. 05 Det-Seg-Name Picture X(8). 05 Det-Len-KFB Picture S9(5) Comp-5. 05 Det-Nu-Senseg Picture S9(5) Comp-5. 05 Det-Key-FB Picture X(256).
  • 7.
    Program • In thelinkage section we need to give IO- PCB,DB-PCB,GSAM-PCB definitions.
  • 8.
    Program Procedure Division usingIO-PCB DB-PCB-Mast DB-PCB-Detail. Call 'CBLTDLI' using Func-GU DB-PCB-Detail Det-seg-in Qual-SSA-Det. . . Call 'CBLTDLI' using Parmcount Func-ghu DB-PCB-Mast Mast-seg-in Qual-SSA-Mast. . . Call 'CBLTDLI' using Func-GHN DB-PCB-Mast Mast-seg-in. . . Call 'CBLTDLI' using Func-REPL DB-PCB-Mast Mast-seg-in. . . Goback.
  • 9.
    Program • ENTRY 'DLITCBL'using PCB-MASK – This is to be given only in main program in procedure division. Not needed in sub-program • All PCBs must be defined the order they defined in PSB • Why batch program needed IO-PCB with CMPAT=YES => to make system service calls
  • 10.
    Program • The callsare with SSA both qualified and un- qualified.
  • 11.