View previous topic :: View next topic |
Author |
Message |
nbdtrjk Beginner
Joined: 08 Mar 2006 Posts: 17 Topics: 11
|
Posted: Wed Mar 08, 2006 8:30 am Post subject: Expand Copybook |
|
|
Hi..
my requirement is need to expand copybook used in my COBOL program. Plz note that my copybook list is present in different dateset and COBOL pgm is present in different dataset.
Thanks in Advance |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Wed Mar 08, 2006 8:39 am Post subject: |
|
|
nbdtrjk,
Simply add the new fields to the copy book and recompile the cobol pgm once again. It will pick the new copy book if the copy book dataset is associated to SYSLIB.
Hope this helps..
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
nbdtrjk Beginner
Joined: 08 Mar 2006 Posts: 17 Topics: 11
|
Posted: Wed Mar 08, 2006 8:50 am Post subject: |
|
|
i forget to tell you...i want to do using REXX..If anyone has REXX plz post me. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Wed Mar 08, 2006 10:27 am Post subject: |
|
|
Quote: |
forget to tell you...i want to do using REXX..If anyone has REXX plz post me.
|
REXX? huh ? why ? No matter what tool you use you still need to recomplie your COBOL pgm. Why can't you just edit the copybook and add new fields?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
sriramla Beginner
Joined: 22 Feb 2003 Posts: 74 Topics: 1
|
Posted: Wed Mar 08, 2006 10:40 am Post subject: |
|
|
If you would like to see the copybook in the COBOL program itself then you can use the below Rexx edit macro. Please note that you need to use this as edit macro by typing the macro name (Example: EXCOPY) then put the cursor in the line having the COPY statement and then press ENTER key. (Alternatively you can mark the block of code using astericks (*) and type EXCOPY. You will see all the COPYbooks within the block expanded)
Before using this macro, change the cpylib variables to point to your cpylibs.
Code: |
/* REXX */
/**************************************************/
/* Tool to EXPAND the COPY BOOKS AND DCLGEN'S */
/**************************************************/
ADDRESS ISREDIT
"MACRO NOPROCESS"
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
/* You can use astericks (*) as line command to give the range */
"PROCESS RANGE *"
"(pchar) = RANGE_CMD"
"(beginLn) = LINENUM .ZFRANGE"
"(EndLn) = LINENUM .ZLRANGE"
cpylib.0=5
cpylib.1='PDS name 1'
cpylib.2='PDS name 2'
cpylib.3='PDS name 3'
cpylib.4='PDS name 4'
cpylib.5='PDS name 5'
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
if pchar = ' ' then
do
"(beginLn) = LINENUM .ZCSR"
endln = beginln
end
Do i=beginLn to endLn
"(currLine) = LINE "i
"(linenum) = LINENUM "i
cpyname= ' '
len1=0
len2=0
if substr(currLine,7,1) = '*' then iterate
parse var currLine with . " COPY " cpyname .
cpyname = word(cpyname,1)
if index(cpyname,".") = 0 & length(cpyname) > 0 then do
cpyname =cpyname"."
End
if length(cpyname) = 0 then
do
parse var currLine with . " INCLUDE " incname .
if length(incname) = 0 then iterate
end
if length(cpyname) > 0 then
do
len1= length(cpyname)
len2= len1 - 1
end
else
do
len2 = length(incname)
cpyname = incname
end
found=0
Do j=1 to cpylib.0
ddin1 = strip(cpylib.j)||"("||strip(substr(cpyname,1,len2)) || ")"
message = SYSDSN("'"ddin1"'")
if message = OK then do
found=1
j=cpylib.0 + 10 /*To come out of the loop*/
End
end
if found=0 then iterate
address tso "ALLOC FI(copydd) DA('"ddin1"') SHR"
address tso "EXECIO * DISKR copydd (STEM lines. FINIS"
address tso "FREE FI(copydd)"
stexp="E X P A N S I O N S T A R T S H E R E"
enexp="E X P A N S I O N E N D S H E R E"
ADDRESS ISREDIT "LINE_AFTER" Linenum"= MSGLINE (enexp)"
do j =lines.0 to 1 by -1
cpytxt=lines.j
ADDRESS ISREDIT "LINE_AFTER" Linenum"= NOTELINE (cpytxt)"
end
ADDRESS ISREDIT "LINE_AFTER" Linenum"= MSGLINE (stexp)"
End
|
|
|
Back to top |
|
|
ranga_subham Intermediate
Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Tue Mar 21, 2006 11:47 pm Post subject: how to make this work for includes?? |
|
|
Hi sriramla,
How to make it work for ++INCLUDE statements within a COBOL-DB2 programs?
Thanks. _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Wed Mar 22, 2006 4:11 am Post subject: |
|
|
Ranga,
Did you ever try running the tool ? I think it handles INCLUDE statements also.
check this line
Code: |
parse var currLine with . " INCLUDE " incname .
|
The only think you have to take care in case of Include statement is that you may have to check for DCLGEN pds also in addition to Copy library.
Thanks,
Phantom |
|
Back to top |
|
|
ranga_subham Intermediate
Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Wed Mar 22, 2006 9:07 am Post subject: |
|
|
Yes Phantom. I was successful with COPY but could not get anything when I tried it on ++INCLUDE. In our shop, copybooks and DCLGENs are kept in the same PDS. _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
|
rajkumarfit Beginner
Joined: 19 Dec 2005 Posts: 8 Topics: 5
|
Posted: Wed Mar 22, 2006 10:00 am Post subject: |
|
|
hi
may be u should try with
parse var currLine with . "INCLUDE" incname . this
instead of
parse var currLine with . " INCLUDE " incname .
Rajkumar |
|
Back to top |
|
|
ranga_subham Intermediate
Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Thu Mar 23, 2006 2:00 am Post subject: |
|
|
Hi,
I changed the parse value to have " ++INCLUDE ". It is working fine now.
Thank you guys. _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
|
|
|