0% found this document useful (0 votes)
152 views19 pages

Compile and Debug COBOL/400 Programs

This document provides instructions for compiling and debugging Cobol programs using the AS/400 Programming Development Manager (PDM). It describes selecting the "Work with members" option in PDM, entering a library name, choosing a program member to compile, changing the compile options to allow for debugging, submitting the compile job, and checking the status of the compiled program. Key steps include compiling the SENIOR program, changing the source listing option to ISRCD01, replacing the existing object, and viewing the compiled spool file to confirm successful compilation.

Uploaded by

congku
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
152 views19 pages

Compile and Debug COBOL/400 Programs

This document provides instructions for compiling and debugging Cobol programs using the AS/400 Programming Development Manager (PDM). It describes selecting the "Work with members" option in PDM, entering a library name, choosing a program member to compile, changing the compile options to allow for debugging, submitting the compile job, and checking the status of the compiled program. Key steps include compiling the SENIOR program, changing the source listing option to ISRCD01, replacing the existing object, and viewing the compiled spool file to confirm successful compilation.

Uploaded by

congku
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

Compiling and Debugging Cobol/400 programs

AS/400 Programming Development Manager (PDM)


Select one of the following:
1. Wor with li!rarie"
#. Wor with o!$ect"
%. Wor with mem!er"
4. Wor with pro$ect"
&. Wor with gro'p"
(. Wor with part"
). Wor with '"er*+efine+ option"
Selection or comman+
,,,- %
.%,/0it .4,Prompt .),1etrieve .10,2omman+ entr3
.1#,2ancel .14,2hange +efa'lt"
(2) 25P61789: 7;M 251P. 1)41< 1))4.
Start PDM (using STRPDM) and when the above sreen is displa!ed selet option "
and press #nter$
Specif3 Mem!er" to Wor With
:3pe choice"< pre"" /nter.
.ile . . . . . . . . . . =2;>S12 ?ame< .4 for li"t
>i!rar3 . . . . . . . . M59AM/D @>7;>< @2A1>7;< name
Mem!er:
?ame . . . . . . . . . @A>> @A>>< name< @generic@
:3pe . . . . . . . . . @A>> @A>>< t3pe< @generic@< @;>A?B
.%,/0it .4,Prompt .&,1efre"h .1#,2ancel
#nter !our librar! name (instead o% librar! M&'(M#D) and then press #nter$
Wor with Mem!er" A"ing PDM 5D7?
.ile . . . . . . =2;>S12
>i!rar3 . . . . M59AM/D Po"ition to . . . . .
:3pe option"< pre"" /nter.
#,/+it %,2op3 4,Delete &,Di"pla3 (,Print C,1ename
4,Di"pla3 +e"cription ),Save 1%,2hange te0t 14,2ompile 1&,2reate mo+'le...
5pt Mem!er :3pe :e0t
2;>%44P 2;> 7ntro to 2o!ol programming
2;>%44P? 2;> 7ntro to 2o!ol programming
14 S/?751 2;> :he fir"t 2o!ol program
:A7:75?% 2;> :'ition program (7nitial with "t'!")
:A7:75?& 2;> :'ition program (2omplete+)
;ottom
Parameter" or comman+
,,,-
.%,/0it .4,Prompt .&,1efre"h .(,2reate
.),1etrieve .10,2omman+ entr3 .#%,More option" .#4,More e3"
(s an e)ample * hoose to ompile program S#+*&R$ To do that enter ,4 and then
press -4$
2reate 25;5> Program (21:2;>P8M)
:3pe choice"< pre"" /nter.
Program . . . . . . . . . . . . - S/?751 ?ame< @P8M7D
>i!rar3 . . . . . . . . . . . - M59AM/D ?ame< @2A1>7;
So'rce file . . . . . . . . . . - =2;>S12 ?ame
>i!rar3 . . . . . . . . . . . - M59AM/D ?ame< @>7;>< @2A1>7;
So'rce mem!er . . . . . . . . . - S/?751 ?ame< @P8M
8eneration "everit3 level . . . #) 0*#)
:e0t D+e"criptionD . . . . . . . @S12M;[Link]
A++itional Parameter"
1eplace program . . . . . . . . - @?5 @?5< @6/S
;ottom
.%,/0it .4,Prompt .&,1efre"h .10,A++itional parameter" .1#,2ancel
.1%,9ow to '"e thi" +i"pla3 .#4,More e3"
*n order to use the *nterative Soure Debugger later on. !ou have to hange the
ompile options in this sreen$ To do that press -,0$
2reate 25;5> Program (21:2;>P8M)
:3pe choice"< pre"" /nter.
Program . . . . . . . . . . . . - S/?751 ?ame< @P8M7D
>i!rar3 . . . . . . . . . . . - M59AM/D ?ame< @2A1>7;
So'rce file . . . . . . . . . . - =2;>S12 ?ame
>i!rar3 . . . . . . . . . . . - M59AM/D ?ame< @>7;>< @2A1>7;
So'rce mem!er . . . . . . . . . - S/?751 ?ame< @P8M
8eneration "everit3 level . . . #) 0*#)
:e0t D+e"criptionD . . . . . . . @S12M;[Link]
A++itional Parameter"
So'rce li"ting option" . . . . . @S12D;8 @S5A12/< @?5S5A12/< @S12...
F for more val'e"
8eneration option" . . . . . . . @?5>7S:< @>7S:< @?5E1/....
F for more val'e"
More...
.%,/0it .4,Prompt .&,1efre"h .1#,2ancel .1%,9ow to '"e thi" +i"pla3
.#4,More e3"
#nter /SRCD01 as the Soure listings option and then press #nter$
2onfirm 2ompile of Mem!er
:he following o!$ect alrea+3 e0i"t" for the compile operation:
5!$ect which e0i"t" . . . . . . . . : S/?751
>i!rar3 . . . . . . . . . . . . . : M59AM/D
5!$ect t3pe . . . . . . . . . . . . : @P8M
Mem!er to compile . . . . . . . . . : S/?751
.ile . . . . . . . . . . . . . . . . : =>;>S12
>i!rar3 . . . . . . . . . . . . . : M59AM/D
:3pe choice< pre"" /nter.
Pre"" .1#,2ancel to ret'rn an+ not perform the compile operation.
Delete e0i"ting o!$ect . . . . . . . . 6 6,6e"< ?,?o
.1#,2ancel
To replae the old ompiled version o% the program enter 234 and then press #nter$
Wor with Mem!er" A"ing PDM 5D7?
.ile . . . . . . =2;>S12
>i!rar3 . . . . M59AM/D Po"ition to . . . . .
:3pe option"< pre"" /nter.
#,/+it %,2op3 4,Delete &,Di"pla3 (,Print C,1ename
4,Di"pla3 +e"cription ),Save 1%,2hange te0t 14,2ompile 1&,2reate mo+'le...
5pt Mem!er :3pe :e0t
S/?751 2;> :he fir"t 2o!ol program
:A7:75?% 2;> :'ition program (7nitial with "t'!")
:A7:75?& 2;> :'ition program (2omplete+)
;ottom
Parameter" or comman+
,,,-
.%,/0it .4,Prompt .&,1efre"h .(,2reate
.),1etrieve .10,2omman+ entr3 .#%,More option" .#4,More e3"
:he compile of mem!er S/?751 wa" "'!mitte+ to !atch. F
The ompilation o% the program will be submitted to bath$
Wor with Mem!er" A"ing PDM 5D7?
.ile . . . . . . =2;>S12
>i!rar3 . . . . M59AM/D Po"ition to . . . . .
:3pe option"< pre"" /nter.
#,/+it %,2op3 4,Delete &,Di"pla3 (,Print C,1ename
4,Di"pla3 +e"cription ),Save 1%,2hange te0t 14,2ompile 1&,2reate mo+'le...
5pt Mem!er :3pe :e0t
S/?751 2;> :he fir"t 2o!ol program
:A7:75?% 2;> :'ition program (7nitial with "t'!")
:A7:75?& 2;> :'ition program (2omplete+)
;ottom
Parameter" or comman+
,,,- W1BS;MG5; @G5;
.%,/0it .4,Prompt .&,1efre"h .(,2reate
.),1etrieve .10,2omman+ entr3 .#%,More option" .#4,More e3"
Go! %4#4C0/M59AM/D/S/?751 "'!mitte+ to $o! H'e'e =;A:29 in li!rar3 =8P>.
To he5 whether the program ompiled suess%ull! enter 6R7S0M8&0 /8&0 on
the ommand line as shown and then press #nter$
Wor with S'!mitte+ Go!" 5D7?
10/0%/)) 1C:&%:1%
S'!mitte+ from . . . . . . . . : @G5;
:3pe option"< pre"" /nter.
#,2hange %,9ol+ 4,/n+ &,Wor with (,1elea"e C,Di"pla3 me""age
4,Wor with "poole+ file"
5pt Go! A"er :3pe *****Stat'"***** .'nction
4 S/?751 M59AM/D ;A:29 5A:=
;ottom
Parameter" or comman+
,,,-
.%,/0it .4,Prompt .&,1efre"h .),1etrieve .11,Di"pla3 "che+'le +ata
.1#,2ancel
#nter option 9 to displa! the ompiled spool %ile$
Wor with Go! Spoole+ .ile"
Go!: S/?751 A"er: M59AM/D ?'m!er: %4#4C0
:3pe option"< pre"" /nter.
1,Sen+ #,2hange %,9ol+ 4,Delete &,Di"pla3 (,1elea"e C,Me""age"
4,Attri!'te" ),Wor with printing "tat'"
Device or :otal 2'rrent
5pt .ile ='e'e A"er Data Stat'" Page" Page 2opie"
& S/?751 M59AM/D 1D6 & 1
;ottom
Parameter" for option" 1< #< % or comman+
,,,-
.%,/0it .10,Iiew % .11,Iiew # .1#,2ancel .##,Printer" .#4,More e3"
To view the ompiled program spool %ile enter option : and press #nter$
Di"pla3 Spoole+ .ile
File . . . . . : SENIOR Page/Line 1/1
Control . . . . . B Columns 1 - 130
Fin . . . . . . !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
"...
#....1....#....$....#....3....#....%....#....&....#....'....#....(....#....)....#....*....#....0....#....1....#....$....#....3
&('*CB1 +%R$,0 *)0$$) IB, COBOL/%00 ,O-.,E//SENIOR
O/IN 10/03/** 1(:%&:&3 Page 1
Program . . . . . . . . . . . . . . : SENIOR
Li0rar1 . . . . . . . . . . . . . : ,O-.,E/
Sour2e 3ile . . . . . . . . . . . . : 4LBLSRC
Li0rar1 . . . . . . . . . . . . . : ,O-.,E/
Sour2e mem0er . . . . . . . . . . . : SENIOR 0*/11/** 1(:$$:&$
5eneration se6erit1 le6el . . . . . : $*
7e8t 9es2ri:tion9 . . . . . . . . . : 7;e 3irst Co0ol :rogram
Sour2e listing o:tions . . . . . . . : "SRC/B5
5eneration o:tions . . . . . . . . . : "NONE
Con6ersion o:tions . . . . . . . . . : "NONE
Sort se<uen2e . . . . . . . . . . . : "-E=
Li0rar1 . . . . . . . . . . . . . :
Language ienti3ier . . . . . . . . : ">OBR?N
,essage limit:
Num0er o3 messages . . . . . . . . : "NO,.=
,essage limit se6erit1 . . . . . . : $*
Print 3ile . . . . . . . . . . . . . : 4S@SPR7
Li0rar1 . . . . . . . . . . . . . : "LIBL
,ore...
F3AE8it F1$ACan2el F1*ALe3t F$0ARig;t F$%A,ore Be1s
#nter 0 in the ontrol %ield and press #nter to go to the bottom o% the ompile
listing$
/is:la1 S:oole File
File . . . . . : SENIOR Page/Line %/3%
Control . . . . . B Columns 1 - 130
Fin . . . . . .
"...
#....1....#....$....#....3....#....%....#....&....#....'....#....(....#....)....#....*....#....0....#....1....#....$....#....3
" %% ,S5I/: LBL001% SE+ERI7@: 10 SE4NBR: 00&*00
,essage . . . . : /elimiter 3or literal is not 2orre2t.
Literal a22e:te.
" %* ,S5I/: LBL001% SE+ERI7@: 10 SE4NBR: 00'&00
,essage . . . . : /elimiter 3or literal is not 2orre2t.
Literal a22e:te.
" " " " " E N / O F , E S S . 5 E S " " " " "
,essage Summar1
7otal In3oC0-%D EarningC&-1*D ErrorC$0-$*D Se6ereC30-3*D 7erminalC%0-**D
* $ & $ 0 0
Sour2e re2ors rea . . . . . . . . : ''
Co:1 re2ors rea . . . . . . . . . : 0
Co:1 mem0ers :ro2esse . . . . . . : 0
Se<uen2e errors . . . . . . . . . . : 0
-ig;est se6erit1 message issue . . : $0
LBL0*01 00 Program SENIOR 2reate in li0rar1 ,O-.,E/ on 10/03/** 1(:%':$$.
&('*CB1 +%R$,0 *)0$$) .S/%00 COBOL ,essages ,O-.,E//SENIOR O/IN 10/03/** 1(:%&:&3 Page &
S7,7
" " " " " E N / O F C O , P I L . 7 I O N " " " " "

;ottom
.%,/0it .1#,2ancel .1),>eft .#0,1ight .#4,More e3"
The %irst highlighted line shows the number and t!pe o% errors %ound$ The seond
highlighted line states that the ompilation was suess%ul and that the program was
reated in librar! M&'(M#D (in !our ase the program must be reated in !our
own librar!)$
Di"pla3 Spoole+ .ile
File . . . . . : SENIOR Page/Line %/)
Control . . . . . Columns 1 - 130
Fin . . . . . . !!!!!!!!!!!!!!!!!
"...#....1....#....$....#....3....#....%....#....&....#....'....#....(....#....)....#....*....#....0....#....1....#....$....#....3
cla'"e. S3"tem*name =P17?: a""'me+.
@ 1% MS87D: >;>011( S/I/[Link] #0 S/=?;1: 001&00
Me""age . . . . : >arge"t recor+ +e"cription +oe" not match
1/251D 25?:A7?S cla'"e for file. D4#D a""'me+.
@ 1% MS87D: >;>011C S/I/[Link] #0 S/=?;1: 001&00
Me""age . . . . : Smalle"t recor+ +e"cription D4#D character".
Doe" not match 1/251D 25?:A7?S. D4#D a""'me+.
@ 1% MS87D: >;>0(&0 S/I/[Link] 00 S/=?;1: 001&00
Me""age . . . . : ;locing/De!locing for file DS:AD/?:*.7>/D
will !e performe+ !3 compiler*generate+ co+e.
@ #4 MS87D: >;>0014 S/I/[Link] 10 S/=?;1: 00%#00
Me""age . . . . : Delimiter for literal i" not correct.
>iteral accepte+.
@ %C MS87D: >;>0014 S/I/[Link] 10 S/=?;1: 004&00
Me""age . . . . : Delimiter for literal i" not correct.
>iteral accepte+.
@ %) MS87D: >;>0014 S/I/[Link] 10 S/=?;1: 004)00
Me""age . . . . : Delimiter for literal i" not correct.
>iteral accepte+.
,ore...
.%,/0it .1#,2ancel .1),>eft .#0,1ight .#4,More e3"
*% !ou have errors that e)eed severit! level ;< then !our ompile will %ail and !ou
have to sroll up to loo5 at the error messages generated$
Enter
Statement
num0er
an :ress
F1' Cs;i3t
F%D to
sear2; 3or
t;e
statement.
Wor with Go! Spoole+ .ile"
Go!: S/?751 A"er: M59AM/D ?'m!er: %4#4C0
:3pe option"< pre"" /nter.
1,Sen+ #,2hange %,9ol+ 4,Delete &,Di"pla3 (,1elea"e C,Me""age"
4,Attri!'te" ),Wor with printing "tat'"
Device or :otal 2'rrent
5pt .ile ='e'e A"er Data Stat'" Page" Page 2opie"
S/?751 M59AM/D 1D6 & 1
;ottom
Parameter" for option" 1< #< % or comman+
,,,- S:17SD;
.%,/0it .10,Iiew % .11,Iiew # .1#,2ancel .##,Printer" .#4,More e3"
*% the ompile is suess%ul then !ou an run the *nterative Soure Debugger
(STR*SD0) and press #nter$
Start 7SD; (S:17SD;)
:3pe choice"< pre"" /nter.
Program . . . . . . . . . . . . - S/?751 ?ame
>i!rar3 . . . . . . . . . . . - M59AM/D ?ame< @2A1>7;< @>7;>
Ap+ate pro+'ction file" . . . . @?5 @6/S< @?5
7nvoe program . . . . . . . . . @6/S @6/S< @?5< @2MD

;ottom
F3AE8it F%AProm:t F&ARe3res; [Link] :arameters F1$ACan2el
F13A-oF to use t;is is:la1 F$%A,ore Be1s
#nter the program name and librar! as shown (ma5e sure the librar! is !our
librar! name)$ *% !our program is alled diretl! (i$e$ !ou are not using a C=
program or another program to all !our program) then enter /3#S in the *nvo5e
program %ield$
Start IS/B CS7RIS/BD
71:e 2;oi2esG :ress Enter.
Program . . . . . . . . . . . . H SENIOR Name
Li0rar1 . . . . . . . . . . . H ,O-.,E/ NameG "C?RLIBG "LIBL
?:ate :rou2tion 3iles . . . . "NO "@ESG "NO
In6oBe :rogram . . . . . . . . . "@ES "@ESG "NOG "C,/
Parameters 3or 2all . . . . . . !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!
# 3or more 6alues !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!
Bottom
F3AE8it F%AProm:t F&ARe3res; [Link] :arameters F1$ACan2el
F13A-oF to use t;is is:la1 F$%A,ore Be1s
Press #nter$
De!'g 8oto Program 5ption" 9elp
M59AM/D/S/?751:/0001 7SD;/400 More: F -
000100 7D/?:7.72A:75? D7I7S75?.
000#00 P1581AM*7D. S/?751.
000%00 AA:951. 15;/1: 81AA/1.
000400
000&00 /?I715?M/?: D7I7S75?.
000(00 7?PA:*5A:PA: S/2:75?.
000C00 .7>/*25?:15>.
000400 S/>/2: S:AD/?:*.7>/ ASS78? :5 DA:A;AS/*S/?751DA:
000)00 518A?7JA:75? 7S S/=A/?:7A>.
001000 S/>/2: P17?:*.7>/
001100 ASS78? :5 P17?:/1.
001#00
001%00 DA:A D7I7S75?.
001400 .7>/ S/2:75?.
001&00 .D S:AD/?:*.7>/
001(00 1/251D 25?:A7?S 4% 29A1A2:/1S
001C00 DA:A 1/251D 7S S:AD/?:*7?.
001400 01 S:AD/?:*7?.
7SD; ,,,-
.%,/0it .&,Step .(,;rea .11,Di"pla3 varia!le
.1#,2ancel .1C,1'n .#%,2hange varia!le .#4,More e3"
(2) 25P61789: 7;M 251P. 1))%< 1))C.
3ou are now in the *nterative debug mode$ >se the -untion 7e!s (shown
highlighted) to debug !our program$ 3ou an use the -, help %untion to read the
help topis$
De!'g 8oto Program 5ption" 9elp
M59AM/D/S/?751:4#00.1 7SD;/400 More: * F -
004#00 5P/? 7?PA: S:AD/?:*.7>/
004%00 5A:PA: P17?:*.7>/.
004400 1/AD S:AD/?:*.7>/
004&00 A: /?D M5I/ D?5D :5 DA:A*1/MA7?S*SW7:29
004(00 /?D*1/AD.
004C00 P/1.51M W17:/*9/AD7?8*>7?/.
004400 P/1.51M P152/SS*1/251DS
004)00 A?:7> DA:A*1/MA7?S*SW7:29 , D?5D.
00&000 2>5S/ S:AD/?:*.7>/
00&100 P17?:*.7>/.
00&#00 S:5P 1A?.
00&%00
00&400 W17:/*9/AD7?8*>7?/.
00&&00 M5I/ 9/AD7?8*>7?/ :5 P17?:*>7?/.
00&(00 W17:/ P17?:*>7?/.
00&C00
00&400 P152/SS*1/251DS.
00&)00 7. S:A*21/D7:S - 110 A?D S:A*MAG51 , D/?87?//17?8D
7SD; ,,,-
.%,/0it .&,Step .(,;rea .11,Di"pla3 varia!le
.1#,2ancel .1C,1'n .#%,2hange varia!le .#4,More e3"
Stoppe+ at "tatement 4#00.1.
+ote? The debugging starts at the %irst statement o% the %irst paragraph o% the
Proedure Division$
De!'g 8oto Program 5ption" 9elp
M59AM/D/S/?751:4#00.1 7SD;/400 More: * F -
004#00 5P/? 7?PA: S:AD/?:*.7>/
004%00 5A:PA: P17?:*.7>/.
004400 1/AD S:AD/?:*.7>/
004&00 .............................................
004(00 : 2ancel 7SD; :
004C00 : :
004400 : 6o' have reH'e"te+ to cancel 7SD;. :
004)00 : :
00&000 : 7f 3o' are "ervicing another :
00&100 : $o!< enter the /?D7SD; comman+ :
00&#00 : afterwar+< to en+ +e!'gging. :
00&%00 : :
00&400 W1 : 2ancel 7SD; . . . . . . 1 1,6e"< #,?o :
00&&00 : :
00&(00 : .1#,2ancel :
00&C00 :...........................................:
00&400 P152/SS*1/251DS.
00&)00 7. S:A*21/D7:S - 110 A?D S:A*MAG51 , D/?87?//17?8D
7SD; ,,,-
.%,/0it .&,Step .(,;rea .11,Di"pla3 varia!le
.1#,2ancel .1C,1'n .#%,2hange varia!le .#4,More e3"
Stoppe+ at "tatement 4#00.1.
To e)it the debug session press -" and enter , to Canel *SD0$

You might also like