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 

put GDG number in output file.

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


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Wed Mar 03, 2010 1:49 pm    Post subject: put GDG number in output file. Reply with quote

Hi,

Our client is asking us to put the GDG generation number also in the ouput file. How to get the file number and write it to output file?

Code:

//JS001   EXEC PGM=PROGP320,             
//*                                       
//STEPLIB   DD DSN=PRODF.MIDLL.PROD.LOAD,
//             DISP=SHR                   
//IDATA     DD DSN=PRODF.BKUPF.DBPD.TABLE1.INPUT(+1),
//             DISP=SHR                               
//OUTFILES  DD DSN=PRODF.BKUPF.DBPDFILE.QUERY.FILE(+1),
//             AVGREC=K,                               
//             RECFM=FB,                 
//             LRECL=58,                 
//             UNIT=SYSDA,                 
//             BLKSIZE=0,                 
//             DISP=(NEW,CATLG,DELETE),   
//             SPACE=(58,(500,250),RLSE) 
//*                                       


Suppose, if the input file has generation number "G0123V00" then the value "123" should be written to the output file.

Please help.

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Mar 03, 2010 4:52 pm    Post subject: Reply with quote

mf_user,

You are creating a new generation in the program and the catalog isn't updated with the information until you close the dataset or the step running this program ends.

You can read the listcat info and manually increment the generation number but you can never guarantee that it would be right generation number.

you can add 2 steps after the program and read the list cat and append the generation name to it.

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Anuj Dhawan
Intermediate


Joined: 19 Jul 2007
Posts: 298
Topics: 7
Location: Mumbai,India

PostPosted: Thu Mar 04, 2010 3:02 am    Post subject: Reply with quote

What are your choices? 1. You want to update the program,PROGP320, "to pick 123"? 2. or you can afford another job to update the latest generation (output)?

If you go with option one, you need to make sure that no other job is working with this GDG at that moment and then what Kolusu has said can be work-around. For option 2, listcat and sort should give you a go...
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Thu Mar 04, 2010 7:54 am    Post subject: typo Reply with quote

Guys, sorry for the typo......

The input file is current generation (0) only and NOT (+1). The cobol program should pick the generation number from input file and write it to output along with other fields in record layout.

Code:

01 WS-IN-REC.
   01 WS-NAME PIC X(30).
   01 WS-ADDR PIC X(120).
   01 WS-PHON PIC X(10).
   01 WS-OPTN PIC X(3).
   01 WS-GDGN PIC X(4).


So, the GDG generation number "0123" should be put into the filed WS-GDGN.

Please help.

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Thu Mar 04, 2010 9:13 am    Post subject: Reply with quote

What are you willing to do to accomplish your task? It might be helpful to know the groundrules or restrictions we need to work under.

Call IDCAMS?
Call ISPF Services?
Call REXX?
Call TSO?
Call BPXWDYN?

I created this as a small test of one possibility:

COBOL Code:
Code:

       IDENTIFICATION DIVISION.                               
       PROGRAM-ID. GETGDG                                     
       ENVIRONMENT DIVISION.                                   
       INPUT-OUTPUT SECTION.                                   
                                                               
         FILE-CONTROL.                                         
           SELECT INPUT-FILE ASSIGN TO INFILE                 
             ORGANIZATION IS SEQUENTIAL                       
             ACCESS IS SEQUENTIAL.                             
         FILE-CONTROL.                                         
           SELECT DATASET-NAME-FILE ASSIGN TO DSNAME           
             ORGANIZATION IS SEQUENTIAL                       
             ACCESS IS SEQUENTIAL.                             
                                                               
       DATA DIVISION.                                         
       FILE SECTION.                                           
                                                               
       FD  INPUT-FILE                                         
           LABEL RECORD STANDARD                               
           BLOCK 0 RECORDS                                     
           RECORDING MODE F                                   
           RECORD CONTAINS 80 CHARACTERS.                     
       01 INPUT-RECORD                 PIC X(80).             
                                                               
       FD  DATASET-NAME-FILE                                   
           LABEL RECORD STANDARD                               
           BLOCK 0 RECORDS                                     
           RECORDING MODE F                                   
           RECORD CONTAINS 80 CHARACTERS.                     
       01 DATASET-NAME-RECORD.                                 
          03  DATASET-NAME             PIC X(44).             
          03  FILLER                   PIC X(36).             
                                                               
       WORKING-STORAGE SECTION.                               
       01  ARGUMENT.                                           
           03 ARG-SIZE        PIC 9(3) COMP.                   
           03 ARG-CHAR        PIC X(256).                     
       77  PGM-NAME           PIC X(8).                       
                                                               
       PROCEDURE DIVISION.                                     
           MOVE 'GETGDG INFILE DSNAME' TO ARG-CHAR.           
           MOVE 80              TO ARG-SIZE.                   
           MOVE 'IRXJCL'        TO PGM-NAME.                   
           CALL PGM-NAME USING ARGUMENT.                       
           OPEN INPUT DATASET-NAME-FILE.                       
           READ DATASET-NAME-FILE.                             
           DISPLAY DATASET-NAME.                               
           CLOSE DATASET-NAME-FILE.                           
           MOVE ZEROS TO RETURN-CODE.                         
           STOP RUN.                                           


Execution JCL:
Code:

//STEP0001 EXEC PGM=ICEGENER                                           
//SYSUT1   DD   *,DLM=@@                                               
/* REXX GETGDG */                                                             
PARSE ARG DDNAME OUTDDNAME .                                           
CALL BPXWDYN 'INFO FI('DDNAME') INRTDSN(DSN)'                         
CALL BPXWDYN 'ALLOC FI('OUTDDNAME') NEW REUSE RECFM(F,B)',             
             'LRECL(80) UNIT(VIO)'                                     
PUSH DSN                                                               
'EXECIO 1 DISKW 'OUTDDNAME' (FINIS'                                   
EXIT 0                                                                 
@@                                                                     
//SYSUT2   DD   DSN=&&PDS(GETGDG),DISP=(,PASS),UNIT=VIO,               
//         SPACE=(TRK,(1,1,1),RLSE)                                   
//SYSPRINT DD   SYSOUT=*                                               
//SYSIN    DD   DUMMY                                                 
//*                                                                   
//STEP0002 EXEC PGM=GETGDG                                             
//SYSEXEC  DD   DSN=&&PDS,DISP=(OLD,PASS)                             
//SYSOUT   DD   SYSOUT=*                                               
//SYSTSPRT DD   SYSOUT=*                                               
//SYSTSIN  DD   DUMMY                                                 
//INFILE   DD   DISP=SHR,DSN=HLQ.GDG(0)
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Thu Mar 04, 2010 10:30 am    Post subject: Reply with quote

Also, try the code provided in this thread:

http://groups.google.com/group/comp.lang.cobol/browse_thread/thread/85e935011cdff787/24ecab6b49c46c74%2324ecab6b49c46c74?sa=X&oi=groupsr&start=0&num=3
Back to top
View user's profile Send private message
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Thu Mar 04, 2010 11:51 am    Post subject: thanks a lot Reply with quote

Hi,

Thanks a ton. The google link is also very helpful. I am going to try it out.

Would you post the solution if possible to achieve using IDCAMS.

Thanks a lot again.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Mar 04, 2010 12:19 pm    Post subject: Re: thanks a lot Reply with quote

mf_user wrote:
Hi,

Thanks a ton. The google link is also very helpful. I am going to try it out.

Would you post the solution if possible to achieve using IDCAMS.

Thanks a lot again.


mf_user,

*Sigh* You could have searched the application programming forum for IDCAMS and you would have found an example of Cobol calling IDCAMS.

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

I just noticed that you are even a part of that discussion. bonk


Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Thu Mar 04, 2010 12:36 pm    Post subject: ok Reply with quote

Embarassed

Thanks Kolusu.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
semigeezer
Supermod


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

PostPosted: Thu Mar 04, 2010 1:11 pm    Post subject: Reply with quote

If you want to find the info yourself, search the TIOT and JFCB control blocks. This can be done from COBOL and a search will find examples. I don't much care for the listcat solution because of the possibility of getting the wrong name due to concurrent jobs. If you must use the catalog, you can get the name quickly via a locate macro (SVC 26). Svc 99 can also get the name allocated to the ddname as has already been show via bpxwdyn.
_________________
New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html.
Back to top
View user's profile Send private message Visit poster's website
DaveyC
Moderator


Joined: 02 Dec 2002
Posts: 151
Topics: 3
Location: Perth, Western Australia

PostPosted: Tue Mar 09, 2010 1:45 am    Post subject: Reply with quote

Here is the code for a locate routine. Linkage is left as an exercise.

Code:

LOCATE   CSECT ,                                                        00290105
LOCATE   AMODE 31                                                       00290205
LOCATE   RMODE ANY                                                      00290305
         SAVE  (14,12)            .Save callers registers               00290605
         LR    R12,R15            .R12=base                             00290705
         USING LOCATE,R12       .Addressability                         00290805
         ICM   R11,15,0(R1)       .-> Parameter List Structure          00380000
         USING LOCPLIST,R11       .Parameter List Structure addressing  00390000
*---------------------------------------------------------------------* 00400004
* Locate the DSN                                                      * 00410004
*---------------------------------------------------------------------* 00420004
         MVC   LOCCAML(CAMLSTL),CAMLST .Init CAMLST                     00430004
         LA    R1,LOCDSN               .DSN                             00440004
         ST    R1,LOCCAML+4            .Put into CAMLST                 00450004
         LA    R1,LOCAREA              .Work Area                       00460004
         ST    R1,LOCCAML+12           .Put into CAMLST                 00470004
         LOCATE LOCCAML                .Look in Catalog for DSN         00480004
         LTR   R15,R15                  .Cataloged?                     00490004
         BNZ   EXIT                     .N:                             00491004
         MVC   LOCWAREA(6),LOCAREA+6    .Set VOLSER from catalog        00492004
         MVI   LOCWAREA+6,C' '          .7 byte VOLSER for MIGRAT       00493004
         CLC   LOCWAREA(6),=CL8'MIGRAT' .Dataset is HSM migrated?       00494004
         BNE   EXIT                     .N: Finished                    00495004
         TM    LOCAREA+4,X'20'          .DASD?                          00496004
         BO    HSMMIGL1                 .Y:                             00497004
         TM    LOCAREA+4,X'80'          .Tape?                          00498004
         BO    HSMMIGL2                 .Y:                             00499004
         B     EXIT                     .Return to caller               00499104
HSMMIGL1 MVI   LOCWAREA+6,C'1'          .Migration Level 1 - DASD       00499204
         B     EXIT                     .Return to caller               00499304
HSMMIGL2 MVI   LOCWAREA+6,C'2'          .Migration Level 2 - Tape       00499404
         B     EXIT                     .Pass back return code          00499504
*---------------------------------------------------------------------* 00500000
* Exit                                                                * 00510000
*---------------------------------------------------------------------* 00520000
EXITNEG  L     R15,=F'-1'          .RC=Negative, PLIST is in error      00530000
         B     EXIT                                                     00540000
EXITPOS  LA    R15,8               .RC=8, LOCATE request failed         00550000
         B     EXIT                                                     00560000
EXIT0    SR    R15,R15             .RC=0, LOCATE request successful     00570000
EXIT     RETURN (14,12),RC=(15)    .Return to caller                    00580000
         EJECT ,                                                        00590000
*---------------------------------------------------------------------* 00600000
* Constants                                                           * 00610000
*---------------------------------------------------------------------* 00620000
CAMLST   CAMLST NAME,0,,0          .LOCATE SVC Parameter List           00630000
CAMLSTL  EQU   *-CAMLST                                                 00640000
         LTORG ,                   .Literal Pool Origin                 00650000
         EJECT ,                                                        00660000
*---------------------------------------------------------------------* 00670000
* Locate DSN Parameter List                                           * 00680000
*---------------------------------------------------------------------* 00690000
LOCPLIST DSECT ,                   .Locate Parameter List               00700000
LOCDSN   DS    CL44                .Data Set Name                       00710000
LOCWAREA DS    0D,CL300            .Work area                           00720000
         ORG   LOCWAREA            .Map our work area                   00730000
LOCCAML  CAMLST NAME,0,,0          .LOCATE SVC Parameter List           00740000
LOCAREA  DS    268C                .LOCATE SVC Work Area                00750000
         ORG   ,                                                        00760000
LOC1LEN  EQU   *-LOCPLIST          .Version 1 Plist length              00770000
         EJECT ,                                                        00780000
*---------------------------------------------------------------------* 00790000
* System macros                                                       * 00800000
*---------------------------------------------------------------------* 00810000
         YREGS ,                   .Register equates                    00820000
         END                                                            00830000

_________________
Dave Crayford
Back to top
View user's profile Send private message Send e-mail
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Tue May 04, 2010 5:59 am    Post subject: Thanks Reply with quote

Hi,

Thanks everyone !
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
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