MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Expand Copybook

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
nbdtrjk
Beginner


Joined: 08 Mar 2006
Posts: 17
Topics: 11

PostPosted: Wed Mar 08, 2006 8:30 am    Post subject: Expand Copybook Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Wed Mar 08, 2006 8:39 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
nbdtrjk
Beginner


Joined: 08 Mar 2006
Posts: 17
Topics: 11

PostPosted: Wed Mar 08, 2006 8:50 am    Post subject: Reply with quote

i forget to tell you...i want to do using REXX..If anyone has REXX plz post me.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Wed Mar 08, 2006 10:27 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
sriramla
Beginner


Joined: 22 Feb 2003
Posts: 74
Topics: 1

PostPosted: Wed Mar 08, 2006 10:40 am    Post subject: Reply with quote

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
View user's profile Send private message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Tue Mar 21, 2006 11:47 pm    Post subject: how to make this work for includes?? Reply with quote

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
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Wed Mar 22, 2006 4:11 am    Post subject: Reply with quote

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
View user's profile Send private message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Wed Mar 22, 2006 9:07 am    Post subject: Reply with quote

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
View user's profile Send private message
rajkumarfit
Beginner


Joined: 19 Dec 2005
Posts: 8
Topics: 5

PostPosted: Wed Mar 22, 2006 10:00 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Yahoo Messenger
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Thu Mar 23, 2006 2:00 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group