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 

Assembler function to pass GDG level to COBOL
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
wdnealis
Beginner


Joined: 17 Jan 2006
Posts: 25
Topics: 4

PostPosted: Tue Jan 17, 2006 11:11 am    Post subject: Assembler function to pass GDG level to COBOL Reply with quote

Is there an assembler function to pass GDG leve to COBOL? I need to find or access the current level of a GDG from within COBOL.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jan 17, 2006 11:22 am    Post subject: Reply with quote

wdnealis,

Why do you need assembler ? You can call IDCAMS from COBOL and you can read output from IDCAMS and get the current gdg version.

There is Sort solution also. check this link

http://www.mvsforums.com/helpboards/viewtopic.php?p=621#621

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
wdnealis
Beginner


Joined: 17 Jan 2006
Posts: 25
Topics: 4

PostPosted: Tue Jan 17, 2006 12:13 pm    Post subject: Reply with quote

ok, I'll this, and get back

thanks.
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Tue Jan 17, 2006 1:21 pm    Post subject: Reply with quote

If you want an assembler solution, issue an SVC 26 (LOCATE) on the dsn(0) name and it will return the real dsname. Its only a few lines of assembler. See the REALNAME rexx function written in assembler for an example.
Back to top
View user's profile Send private message Visit poster's website
wdnealis
Beginner


Joined: 17 Jan 2006
Posts: 25
Topics: 4

PostPosted: Tue Jan 17, 2006 1:46 pm    Post subject: Reply with quote

So a call to IDCAM will produce the same results as this?

kolusu wrote:
Maneesh chawla,

The following DFSORT jcl will give you the desired results.Cogito has the right idea but he is making 3 passes to get the data.You can avoid all that and do it in just 1 pass.

Code:

//STEP0100 EXEC PGM=IKJEFT01                       
//*                                                 
//SYSTSPRT DD DSN=&L,                               
//            DISP=(,PASS),                         
//            SPACE=(CYL,(X,Y),RLSE),             
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)     
//SYSTSIN  DD *                                     
  LISTCAT ENT('GDG NAME')                   
//*                                                 
//STEP0200 EXEC PGM=ICEMAN           
//*                                 
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD DSN=&L,DISP=(OLD,PASS)
//SORTOUT  DD DSN=YOUR LATEST GDGNAME DSN,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(TRK,(1,1),RLSE)               
//SYSIN    DD *                     
  INCLUDE COND=(4,7,CH,EQ,C'NONVSAM')
  INREC FIELDS=(1,80,SEQNUM,8,ZD)     
  SORT FIELDS=(81,8,ZD,D)             
  OUTFIL ENDREC=1,OUTREC=(17,44,80:X)
/*                                   


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jan 17, 2006 2:10 pm    Post subject: Reply with quote

Quote:

So a call to IDCAM will produce the same results as this?

wdnealis,

Change the step0100 to a permanent dataset and that is what you will read in your cobol program after a call to IDCAMS

Code:

//STEP0100 EXEC PGM=IKJEFT01                       
//*                                                 
//SYSTSPRT DD DSN=LISTCAT INFO DSN,                               
//            DISP=(NEW,CATLG,DELETE),                         
//            SPACE=(CYL,(X,Y),RLSE),             
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)     
//SYSTSIN  DD *                                     
  LISTCAT ENT('GDG NAME')                   
//*                 


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
wdnealis
Beginner


Joined: 17 Jan 2006
Posts: 25
Topics: 4

PostPosted: Wed Jan 18, 2006 10:56 am    Post subject: Reply with quote

I used IDCAMS to produce the latest GDG, but there was other information in the file created, so I tried to SORT the output from the SYSPRINT; but I got a RC=16 (RDW NOT INCLUDED). When I searched the site I noticed that you need 4 bytes for the VB files, but when I added I still got the RC=16. What is the issue with this syntax?

Code:

************************** Top of Data ****************************
//IDCMSORT JOB (XXXXXXXXXXXX,XXX),'IDCAMS SORT',MSGCLASS=X,REGION=XX,   
//             CLASS=0,NOTIFY=XXXX                           
/*JOBPARM  LINES=9999                                                   
//STEP01 EXEC PGM=IDCAMS,DYNAMNBR=1                                     
//SYSPRINT DD DSN=MY.CURRENT.GDG,                                     
//             DISP=SHR                                                 
//*            DISP=(NEW,CATLG,DELETE),                                 
//*            SPACE=(TRK,(1,1),RLSE),                                 
//*            DCB=(RECFM=VBA,LRECL=125,BLKSIZE=27998)                 
//SYSIN DD *                                                           
  LISTCAT ENTRIES('MY.GDG') NAME                     
/*                                                                     
//STEP02    EXEC PGM=SORT,COND=(0,NE)                                   
//SYSPRINT  DD SYSOUT=*                                                 
//SYSOUT    DD SYSOUT=*                                                 
//SORTIN    DD DSN=N257.CURRENT.GDG,                                   
//          DISP=SHR                                                   
//*                                                                     
//SORTOUT   DD DSN=MY.IDCAMS.DSN,                               
//             DISP=SHR                                           
//*            DISP=(NEW,CATLG,DELETE),                           
//*            SPACE=(TRK,(1,1),RLSE),                           
//*            DCB=(RECFM=VBA,LRECL=125,BLKSIZE=27998)           
//SYSIN     DD *                                                 
  SORT FIELDS=COPY,SKIPREC=5,STOPAFT=1                           
  OUTFIL OUTREC=(22,44)                                           
//*                                                               
**************************** Bottom of Data **********************
                                                                 



COMMAND ===>                                        SCROLL ===> SCREEN
*************************** Top of Data ******************************
 SYNCSORT FOR Z/OS  1.1DR   TPF3A  U.S. PATENTS: 4210961, 5117495  (C) 2002 SYNC
                                                       z/OS   1.5.0             
 PRODUCT LICENSED FOR CPU SERIAL NUMBER 20F9E, MODEL 2084 304              LICEN
 SYSIN :                                                                       
   SORT FIELDS=COPY,SKIPREC=5,STOPAFT=1                                         
   OUTFIL OUTREC=(22,44)                                                       
 WER164B  7,920K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,             
 WER164B     0 BYTES RESERVE REQUESTED, 2,028K BYTES USED                       
 WER146B  20K BYTES OF EMERGENCY SPACE ALLOCATED                               
 WER108I  SORTIN   :  RECFM=VBA  ; LRECL=   125; BLKSIZE= 27998                 
 WER235A  SORTOUT  OUTREC RDW NOT INCLUDED                                     
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 
 ************************** Bottom of Data ***************************
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jan 18, 2006 11:02 am    Post subject: Reply with quote

wdnealis,

Lake carefully the JCL posted by me. The first step to get the listcat information is using IKJEFT01 pgm and not IDCAMS program.

if you are using IDCAMS then change your sort sysin cards to the following

Code:

  INCLUDE COND=(12,7,CH,EQ,C'NONVSAM')
  INREC FIELDS=(1,4,SEQNUM,8,ZD,5)     
  SORT FIELDS=(5,8,ZD,D)             
  OUTFIL VTOF,ENDREC=1,OUTREC=(30,44,80:X)
/*   


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
wdnealis
Beginner


Joined: 17 Jan 2006
Posts: 25
Topics: 4

PostPosted: Wed Jan 18, 2006 12:24 pm    Post subject: Reply with quote

I noticed that you used IKJEFT01, and the LISTCAT worked. I also tried IDCAMS with the changes listed, but with both IKJEFT01 and DICAMS there was a RC=16 on the SORT(potential insufficient use of INREC).

__________________________________________

IDCAMS
[code:1:1c3234f044]
*************************** Top of Data ******************************
//IDCMSORT JOB (XXXXXXXXXXX,XXXX),'IDCAMS SORT',MSGCLASS=X,REGION=XX,
// CLASS=0,NOTIFY=XXXX
/*JOBPARM LINES=9999
//STEP01 EXEC PGM=IDCAMS,DYNAMNBR=1
//SYSPRINT DD DSN=MY.CURRENT.GDG,
// DISP=SHR
//* DISP=(NEW,CATLG,DELETE),
//* SPACE=(TRK,(1,1),RLSE),
//* DCB=(RECFM=VBA,LRECL=125,BLKSIZE=27998)
//SYSIN DD *
LISTCAT ENTRIES(
Back to top
View user's profile Send private message
German Castillo
Beginner


Joined: 23 Dec 2005
Posts: 83
Topics: 2
Location: Caracas, Venezuela

PostPosted: Wed Jan 18, 2006 1:23 pm    Post subject: Reply with quote

The problem seems to be associated with the DCB of your output dataset. Check the Definition of your sysout, your sort program is trying to write a dataset with 80 as the LRECL, you may either force the real lrecl in your sort step or better yet create a whole new dataset, letting the sort program to do so in your behalf. This are the quick an easy ways, however, several other options are also possible. Also take into consideration that in the way you are creating your sortout dataset it has to be VBA. You do not seem to be doing anything which justifies the OUTFIL statement, It may be worth to think whether or not just an OUTREC statement will suffice in your case.
_________________
Best wishes,

German Castillo
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jan 18, 2006 1:24 pm    Post subject: Reply with quote

wdnealis,

Do not code the DCB parameters for any of the steps. They are automatically calculated. Just follow the example shown in my post.

Thanks

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
wdnealis
Beginner


Joined: 17 Jan 2006
Posts: 25
Topics: 4

PostPosted: Wed Jan 18, 2006 1:51 pm    Post subject: Reply with quote

The problem was with the file being allocated; for some reason a VB file is being created. I just made sure that the parameters matched and it worked. Thanks,

You guys are great; this is a great site.
Back to top
View user's profile Send private message
wdnealis
Beginner


Joined: 17 Jan 2006
Posts: 25
Topics: 4

PostPosted: Mon Apr 03, 2006 1:33 pm    Post subject: Reply with quote

kolusu wrote:
wdnealis,

Why do you need assembler ? You can call IDCAMS from COBOL and you can read output from IDCAMS and get the current gdg version.

Kolusu



How do you call IDCAMS from within COBOL and read and more importantnly trap this information cotaining the current GDG?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Apr 03, 2006 1:53 pm    Post subject: Reply with quote

Quote:

How do you call IDCAMS from within COBOL and read and more importantnly trap this information cotaining the current GDG?

wdnealis,

Please SEARCH before posting. Check this link which has an example of Cobol calling IDCAMS.

http://www.mvsforums.com/helpboards/viewtopic.php?p=10515#10515

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
wdnealis
Beginner


Joined: 17 Jan 2006
Posts: 25
Topics: 4

PostPosted: Wed Apr 12, 2006 1:47 pm    Post subject: Reply with quote

My search brought me back here. "Passing current GDG level to COBOL"

Can I dynamically change the contents of this IDCOMND ddname to the LISTCAT generated in in the program?


The current GDG captured is always the one form the file asociated with the IDCOMND ddname.


I have been able to use the listcat and sort in JCL to get the current GDG, and I can use these results as input into a program.

I have been able to point to the JFCB in asembler (not RDJFC wich may or may not contain the current DSN/GDG level), and

I have been able to call IDCAMS and issue other TSO commands from within Cobol.

However, all of these techniques seem to be limited by the fact that the GDG base has to be know and passed to the program.

The problem with this is that the GDG is created from parameters in a PROC and the base is not captured in any of the steps.

What I need is to trap the current GDG level from within COBOL after the PROC step has dynamically created the GDG.

I am able to generate the LISTCAT for the GDG base created dynamically from the PROC, but the current GDG level written out is always the one listed in the file associated with the IDCOMND DD. If I can changed the contents of this file, so that it contains the new LISTCAT generated from within the program that will resolve this issue.


Any ideas?
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 -> Utilities All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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