CALLING AND USE PROGRAM FROM LIBRARY



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

CALLING AND USE PROGRAM FROM LIBRARY

Postby lrtcoolman » Thu Mar 02, 2017 3:58 pm

I have coded a source program for display GUI.
userconfig.cbl = SCREEN and INTERFACE for configuration and settings.
lib/std/get_age = STANDARD PROGRAM that use to calculate AGE based on DOB (date of birth)


IN userconfig.cbl once compiled, it will display as below:
USERNAME: _____________, data type PIC x(30)
EMAIL: _________________, data type PIC x(40)
DOB: __________________ (X), data type 99/99/9999 where (X) is the age should display calling get_age
HEIGHT: _______________, data type PIC 999V99
WEIGHT: _______________, data type PIC 999V99


My question is, the get_age object is ready to use and how to call and pass the value of DOB and return the (x) = age?

coded
lrtcoolman
 
Posts: 5
Joined: Thu Mar 02, 2017 3:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: CALLING AND USE PROGRAM FROM LIBRARY

Postby NicC » Thu Mar 02, 2017 4:47 pm

Please use code tags when posting code and data and screen shots.

This is a mainframe forum - what you have presented seems to be for a program to run on a PC. The COBOL dialects are different - I do not know if COBOL on the mainframe even specifies a SCREEN SECTION.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: CALLING AND USE PROGRAM FROM LIBRARY

Postby lrtcoolman » Thu Mar 02, 2017 5:06 pm

Here's the user config code >> and the library file at below get_age



       IDENTIFICATION DIVISION.
         PROGRAM-ID.  USER_CFG.
     
      * USER_ADD

       ENVIRONMENT DIVISION.
        INPUT-OUTPUT SECTION.
     FILE-CONTROL.
       COPY '/z/y17b1-a/sp2/lib/fd/fcstd'.
       COPY '/z/y17b1-a/sp2/lib/fd/fccy'.
       COPY '/z/y17b1-a/sp2/lib/fd/fcrc'.
           COPY '/z/y17b1-a/sp2/lib/fd/fcrg'.

       DATA DIVISION.
    FILE SECTION.
           COPY '/z/y17b1-a/sp2/lib/fd/fdstd'.
       COPY '/z/y17b1-a/sp2/lib/fd/fdcy'.
           COPY '/z/y17b1-a/sp2/lib/fd/fdrc'.
           COPY '/z/y17b1-a/sp2/lib/fd/fdrg'.

        WORKING-STORAGE SECTION.
           COPY '/z/y17b1-a/sp2/lib/fd/dbstd'.
       COPY '/z/y17b1-a/sp2/lib/fd/dbcy'.
           COPY '/z/y17b1-a/sp2/lib/fd/dbrc'.
           COPY '/z/y17b1-a/sp2/lib/fd/dbrg'.
       COPY '/v/cps/lib/std/stdvar.def'.
       COPY '/v/cps/lib/std/fkey.def'.
       COPY RESOURCE '/v/cps/lib/icon/help.jpg'.

        01 WS-GENDER             PIC 9(01).
    01 STD-AGE-AUTO          PIC 9(02).
       
    LINKAGE SECTION.
    01 LINK-PROG-KEY         PIC X(30).

         SCREEN SECTION.
         01 SELECT-SCR.
        COPY '/v/cps/lib/std/fmmode.scr'.
        03 LABEL LINE 02 COL 04 'Student AC#:'.
            03 ENTRY-FIELD 3-D ID 101 COL + 3 PIC X(06) USING STD-KEY.
        03 PUSH-BUTTON 'F10 - HELP TABLE' NO-TAB
            COL + 1.5 LINES 13
            BITMAP-HANDLE S-BITMAP
            BITMAP-NUMBER = 1
            TERMINATION-VALUE = 101.

         01 PROCESS-SCR.
         COPY '/v/cps/lib/std/fmmode.scr'.
         03 LABEL LINE 02 COL 04 'Student AC#:'.
         03 ENTRY-FIELD 3-D ENABLED 0 COL 18 PIC X(06) USING STD-KEY.
         03 LABEL LINE 03 COL 04 'Name:'.
         03 ENTRY-FIELD 3-D ID 102 COL 18 PIC X(40) USING STD-NAME.
         03 LABEL LINE 04 COL 04 'Address:'.
         03 ENTRY-FIELD 3-D ID 103 COL 18 PIC X(40) USING STD-ADD1.
         03 ENTRY-FIELD LINE 05 3-D ID 104 COL 18 PIC X(40) USING
             STD-ADD2.
             03 ENTRY-FIELD LINE 06 3-D ID 105 COL 18 PIC X(40) USING
                 STD-ADD3.
             03 LABEL LINE 07 COL 04 'Gender:'.
         03 RADIO-BUTTON ID 106 LINE 7.2 COL 18
             GROUP = 1 GROUP-VALUE = 1 VALUE WS-GENDER.
             03 LABEL LINE 07 COL + 1 'Male'.
             03 RADIO-BUTTON ID 107 LINE 7.2 COL + 3
             GROUP = 1 GROUP-VALUE = 2 VALUE WS-GENDER.
             03 LABEL LINE 07 COL + 1 'Female'.
         03 LABEL LINE 08 COL 04 'DOB:'.
         03 ENTRY-FIELD 3-D ID 108 COL 18 PIC 99/99/9999 USING
             STD-DOB-DMY.
             03 PUSH-BUTTON 'F10-HELP TABLE' NO-TAB
             COL + 1.5 LINES 13
             BITMAP-HANDLE S-BITMAP
             BITMAP-NUMBER = 1
             TERMINATION-VALUE = 108.

     ** THIS IS THE PART THAT WANNA DISPLAY AGE FUNCTION **
            03 ENTRY-FIELD 3-D ID 109 ENABLED 0 COL + 3 PIC 9(03) USING
             STD-AGE-AUTO.
   *******************************************************************************************

            03 LABEL LINE 08 COL + 3 'years old'.
            03 LABEL LINE 09 COL 04 'Height#:'.
        03 ENTRY-FIELD 3-D ID 110 COL 18 PIC 999V99
             USING STD-HEIGHT.
            03 LABEL LINE 10 COL 04 'Weight#:'.
        03 ENTRY-FIELD 3-D ID 111 COL 18 PIC 999V99
             USING STD-WEIGHT.
            03 LABEL LINE 11 COL 04 'Country:'.
        03 ENTRY-FIELD 3-D ID 112 COL 18 PIC X(02) USING STD-CY-KEY.
        03 PUSH-BUTTON 'F10-HELP TABLE' NO-TAB
             COL + 1.5 LINES 13
             BITMAP-HANDLE S-BITMAP
             BITMAP-NUMBER = 1
             TERMINATION-VALUE = 112.
            03 LABEL LINE 12 COL 04 'Race:'.
        03 ENTRY-FIELD 3-D ID 113 COL 18 PIC X(02) USING STD-RC-KEY.
        03 PUSH-BUTTON 'F10-HELP TABLE' NO-TAB
             COL + 1.5 LINES 13
             BITMAP-HANDLE S-BITMAP
             BITMAP-NUMBER = 1
             TERMINATION-VALUE = 113.
            03 LABEL LINE 13 COL 04 'Religion:'.
        03 ENTRY-FIELD 3-D ID 114 COL 18 PIC X(02) USING STD-RG-KEY.
        03 PUSH-BUTTON 'F10-HELP TABLE' NO-TAB
             COL + 1.5 LINES 13
             BITMAP-HANDLE S-BITMAP
             BITMAP-NUMBER = 1
             TERMINATION-VALUE = 114.
            03 LABEL LINE 14 COL 04 'Email#:'.
        03 ENTRY-FIELD 3-D ID 115 COL 18 PIC X(30) USING STD-EMAIL.
        03 LABEL LINE 15 COL 04 'Mobile#:'.
        03 ENTRY-FIELD 3-D ID 116 COL 18 PIC X(30) USING STD-MOBILE.

      ******************************************************************
       PROCEDURE DIVISION USING LINK-PROG-KEY.
   
     DECLARATIVES.
        COPY '/z/y17b1-a/sp2/lib/fd/dcstd'.
        COPY '/z/y17b1-a/sp2/lib/fd/dccy'.
        COPY '/z/y17b1-a/sp2/lib/fd/dcrc'.
            COPY '/z/y17b1-a/sp2/lib/fd/dcrg'.

         END DECLARATIVES.

      ******************************************************************
    BEGIN.

       MOVE 'N' TO S-RUN.
       OPEN I-O STD-FILE.
       OPEN INPUT RC-FILE, CY-FILE, RG-FILE

       MOVE 'Define Student Profile' TO S-WINDOW-TITLE.
       DISPLAY FLOATING WINDOW
           LINES 21 SIZE 115 CELL SIZE = ENTRY-FIELD FONT SEPARATE
       TITLE-BAR MODAL NO SCROLL NO WRAP
       TITLE S-WINDOW-TITLE
           POP-UP S-WINDOW.
       DISPLAY TOOL-BAR, LINES 2.2 BACKGROUND-LOW HANDLE S-TOOLBAR.
           DISPLAY FRAME AT 0102 LINES 20.7 CELL SIZE 110 RAISED.

       CALL 'W$BITMAP' USING
            WBITMAP-LOAD, 'HELP.JPG' GIVING S-BITMAP.

       MOVE 'Y' TO S-RUN.
       INITIALIZE STD-REC.
       PERFORM 0100-MAIN THRU 0199-END UNTIL S-RUN = 'N'.

         TERMINATION.
       CLOSE WINDOW S-WINDOW.
       CLOSE STD-FILE.
       EXIT PROGRAM.
       STOP RUN.

      *****************************************************************
    0100-MAIN.
     
       MOVE 'S' TO S-PRS-MODE.
       PERFORM FKEY-RTN THRU FKEY-END.
       MOVE 1 TO WS-GENDER.

        0110-MAIN.
     
       UNLOCK STD-FILE.
       PERFORM ERROR-RTN THRU ERROR-END.
       DISPLAY SELECT-SCR.
       ACCEPT SELECT-SCR.
           MOVE 4 TO ACCEPT-CONTROL.

           IF K-ESCAPE
          MOVE 'N' TO S-RUN GO TO 0199-END.

           IF K-F2
          PERFORM GET-NEXT THRU GET-NEXT-END
          IF S-STATUS-CHECK = 'Y' OR S-ERROR-CODE NOT = ZEROS
             GO TO 0110-MAIN
              ELSE
             GO TO 0120-MAIN.

           IF K-F3
          PERFORM GET-PREV THRU GET-PREV-END
          IF S-STATUS-CHECK = 'Y' OR S-ERROR-CODE NOT = ZEROS
             GO TO 0110-MAIN
              ELSE
             GO TO 0120-MAIN.

           IF K-F7
          CALL   '/z/y17b1-a/sp2/prg/vwstd' USING LINK-PROG-KEY
          CANCEL '/z/y17b1-a/sp2/prg/vwstd'
          GO TO  0110-MAIN.

       IF (K-F10 AND S-CONTROL-ID = 101) OR KEY-STATUS = 101
           CALL '/z/y17b1-a/sp2/prg/hpstd' USING STD-KEY, S-OK
           CANCEL '/z/y17b1-a/sp2/prg/hpstd'
           MOVE 101 TO S-CONTROL-ID
           IF S-OK = 'Y'
           DISPLAY SELECT-SCR
           GO TO 0120-MAIN.

           IF NOT K-ENTER GO TO 0110-MAIN.

       IF STD-KEY = SPACES
          MOVE 200005 TO S-ERROR-CODE
          MOVE 101 TO S-CONTROL-ID
          GO TO 0110-MAIN.

        0120-MAIN.
       
        MOVE 'N' TO S-STATUS-CHECK.
        MOVE 'R' TO S-PRS-MODE.
        READ STD-FILE INVALID
         MOVE 'A' TO S-PRS-MODE
         INITIALIZE STD-DETAILS
         MOVE ZEROS TO STD-PADDING
         NOT INVALID
             EVALUATE STD-GENDER
              WHEN 'M' MOVE 1 TO WS-GENDER
              WHEN 'F' MOVE 2 TO WS-GENDER
                     END-EVALUATE.


           IF S-STATUS-CHECK = 'Y' GO TO 0190-MAIN.

       DESTROY SELECT-SCR.
       PERFORM FKEY-RTN THRU FKEY-END.

        0130-MAIN.

       PERFORM ERROR-RTN THRU ERROR-END.
       DISPLAY PROCESS-SCR.
       ACCEPT PROCESS-SCR.
       MOVE 4 TO ACCEPT-CONTROL.

       IF K-ESCAPE
         MOVE 'N' TO S-RUN GO TO 0190-MAIN.
         
       IF K-F1 GO TO 0190-MAIN.

       IF K-F2
         PERFORM GET-NEXT THRU GET-NEXT-END
         GO TO 0120-MAIN.

           IF K-F3
         PERFORM GET-PREV THRU GET-PREV-END
         GO TO 0120-MAIN.

           IF K-F4 AND S-PRS-MODE = 'R'
         PERFORM CONFIRM-RTN THRU CONFIRM-END
         IF S-CONFIRM NOT = 'Y'
        DELETE STD-FILE
        GO TO 0190-MAIN
             ELSE
            GO TO 0130-MAIN.

           IF (K-F10 AND S-CONTROL-ID = 108) OR KEY-STATUS = 108
         CALL '/z/y17b1-a/sp2/lib/std/x-hpcal' USING
               STD-DOB-DMY, S-OK
             CANCEL '/z/y17b1-a/sp2/lib/std/x-hpcal'
         MOVE 108 to S-CONTROL-ID
         IF S-OK = 'Y'
            MOVE 109 TO S-CONTROL-ID
        GO TO 0130-MAIN.
    ************** I NOT SURE THIS PART AND HOW TO CALL AND USE THE PROGRAM *********
           IF (K-F10 AND S-CONTROL-ID = 109) OR KEY-STATUS = 109
         CALL '/z/y17b1-a/sp2/lib/std/f-gtage' USING
               STD-DOB-DMY, S-OK
             CANCEL '/z/y17b1-a/sp2/lib/std/f-gtage'
         MOVE 109 to S-CONTROL-ID
         IF S-OK = 'Y'
            MOVE 110 TO S-CONTROL-ID
        GO TO 0130-MAIN.
***************************************************************************************

       IF (K-F10 AND S-CONTROL-ID = 112) OR KEY-STATUS = 112
         CALL '/z/y17b1-a/sp2/prg/hpcy' USING STD-CY-KEY, S-OK
         CANCEL '/z/y17b1-a/sp2/prg/hpcy'
         MOVE 112 to S-CONTROL-ID
         IF S-OK = 'Y'
            MOVE 113 TO S-CONTROL-ID
             GO TO 0130-MAIN.

           IF (K-F10 AND S-CONTROL-ID = 113) OR KEY-STATUS = 113
        CALL '/z/y17b1-a/sp2/prg/hprc' USING STD-RC-KEY, S-OK
        CANCEL '/z/y17b1-a/sp2/prg/hprc'
        MOVE 113 to S-CONTROL-ID
        IF S-OK = 'Y'
           MOVE 114 TO S-CONTROL-ID
            END-IF
        GO TO 0130-MAIN.

           IF (K-F10 AND S-CONTROL-ID = 114) OR KEY-STATUS = 114
        CALL '/z/y17b1-a/sp2/prg/hprg' USING STD-RG-KEY, S-OK
        CANCEL '/z/y17b1-a/sp2/prg/hprg'
        MOVE 114 to S-CONTROL-ID
        IF S-OK = 'Y'
           MOVE 115 TO S-CONTROL-ID
            END-IF
        GO TO 0130-MAIN.

           IF NOT (K-F8 OR K-ENTER) GO TO 0130-MAIN.

       IF STD-NAME = SPACES
        MOVE 200015 TO S-ERROR-CODE
        MOVE 102    TO S-CONTROL-ID
        GO TO 0130-MAIN.

           IF STD-ADD1 = SPACES
             MOVE 200015 TO S-ERROR-CODE
         MOVE 103    TO S-CONTROL-ID
         GO TO 0130-MAIN.

           IF NOT (WS-GENDER = 1 OR 2)
             MOVE 100015 TO S-ERROR-CODE
         MOVE 106    TO S-CONTROL-ID
         GO TO 0130-MAIN.

           IF STD-HEIGHT = ZEROS
             MOVE 100015 TO S-ERROR-CODE
         MOVE 110    TO S-CONTROL-ID
         GO TO 0130-MAIN.

           IF STD-WEIGHT = ZEROS
             MOVE 100015 TO S-ERROR-CODE
         MOVE 111    TO S-CONTROL-ID
         GO TO 0130-MAIN.


      * Type D=DMY, Y=YMD
      * Validation date.
            CALL   '/z/y17b1-a/sp2/lib/std/f-ckdate' USING
           'D', STD-DOB-DMY, S-ERROR-CODE
            CANCEL '/z/y17b1-a/sp2/lib/std/f-ckdate'
        IF S-ERROR-CODE NOT = ZEROS
               MOVE 108 TO S-CONTROL-ID
           GO TO 0130-MAIN.
     
      * GET AGE.
        IF STD-DOB-DMY NOT = ZEROS
            CALL   '/z/y17b1-a/sp2/lib/f-gtage' USING STD-DOB-DMY
                CANCEL '/z/y17b1-a/sp2/lib/f-gtage'.
            MOVE 109 TO S-CONTROL-ID
            GO TO 0130-MAIN.

         
            MOVE 'N' TO S-STATUS-CHECK.
        MOVE STD-CY-KEY TO CY-KEY.
        READ CY-FILE.
        IF S-STATUS-CHECK = 'Y'
           MOVE 112 TO S-CONTROL-ID
           GO TO 0130-MAIN.

            PERFORM CONFIRM-RTN THRU CONFIRM-END.
        IF S-CONFIRM NOT = 'Y'
           GO TO 0130-MAIN.

            EVALUATE WS-GENDER
         WHEN 1 MOVE 'M' TO STD-GENDER
         WHEN 2 MOVE 'F' To STD-GENDER
            END-EVALUATE.

        IF S-PRS-MODE = 'A' WRITE STD-REC.
        IF S-PRS-MODE = 'R' REWRITE STD-REC.

         0190-MAIN.

        DESTROY PROCESS-SCR.

         0199-END. EXIT.

      ******************************************************************
        GET-NEXT.

       START STD-FILE KEY > STD-KEY INVALID
            MOVE 100010 TO S-ERROR-CODE
        NOT INVALID
            READ STD-FILE NEXT END
             MOVE 100010 TO S-ERROR-CODE
                    END-READ.

        GET-NEXT-END.  EXIT.
      ******************************************************************
        GET-PREV.

       START STD-FILE KEY < STD-KEY INVALID
         MOVE 100005 TO S-ERROR-CODE
         NOT INVALID
             READ STD-FILE PREVIOUS END
             MOVE 100005 TO S-ERROR-CODE
                 END-READ.
        GET-PREV-END. EXIT.
      *****************************************************************
    FKEY-RTN.
       
       EVALUATE S-PRS-MODE
         WHEN 'S' MOVE '1yy456y89012y4567890' TO S-ACTIVE-FKEY
         WHEN 'A' MOVE 'yyy4567y9012y4567890' TO S-ACTIVE-FKEY
         WHEN 'R' MOVE 'yyyy567y9012y4567890' TO S-ACTIVE-FKEY.

           CALL   '/v/cps/lib/std/x-fkey' USING
           S-ACTIVE-FKEY, S-TOOLBAR, S-BUTTON.
           CANCEL '/v/cps/lib/std/x-fkey'.

       COPY   '/v/cps/lib/std/fmmode.prd'.

        FKEY-END. EXIT.
      ******************************************************************
       COPY '/v/cps/lib/std/cfirm.prd'.
       COPY '/v/cps/lib/std/errmsg.prd'.
     
      * End of program.


 




       IDENTIFICATION DIVISION.
        PROGRAM-ID.   GET_AGE.

      * Subroutine to get # of Days between Dates (exclude starting date).

       ENVIRONMENT DIVISION.
       DATA DIVISION.
        WORKING-STORAGE SECTION.
        01 WS-DAY-TABLE.
           03 WS-NO                   PIC X(36) VALUE
              '000031059090120151181212243273304334'.
           03 WS-DAY REDEFINES WS-NO  PIC 9(03) OCCURS 12 TIMES.

        01 WS-MISC.
           03 WS-YYYYMMDD1            PIC 9(08).
           03 WS-YYYYMMDD2            PIC 9(08).
           03 WS-SUB                  PIC 9(02).
           03 WS-MTH                  PIC 9(02).
           03 WS-COMP-MTH             PIC 9(04).
           03 WS-LEAP-YEAR-COUNT      PIC 9(04).
           03 WS-REMAIN               PIC 9(01).
              88 LEAP-YEAR            VALUE 0.
           03 OCCURS 2 TIMES.
              05 WS-YYYYMMDD.
                 07 WS-YYYY           PIC 9(04).
                 07 WS-MM             PIC 9(02).
                 07 WS-DD             PIC 9(02).
              05 WS-DAY-COUNT         PIC S9(07).

        LINKAGE SECTION.
        01 LINK-DATE-FORMAT           PIC 9(01).
        01 LINK-DATE1                 PIC 9(08).
        01 LINK-DATE2                 PIC 9(08).
        01 LINK-AGE-TYPE              PIC 9(01).
        01 LINK-DAY-COUNT             PIC S9(07).
 
      ******************************************************************
       PROCEDURE DIVISION USING LINK-DATE-FORMAT, LINK-DATE1,
                                LINK-DATE2, LINK-AGE-TYPE,
                                LINK-DAY-COUNT.  

      * LINK-DATE-FORMAT : 1-ddmmyyyy  2-yyyymmdd
      * LINK-AGE-TYPE    : 1-actual days  2-month-to-month

        BEGIN.

           INITIALIZE LINK-DAY-COUNT, WS-MISC.
           MOVE LINK-DATE1 TO WS-YYYYMMDD1.
           MOVE LINK-DATE2 TO WS-YYYYMMDD2.
           IF LINK-DATE-FORMAT = 1
              CALL   '/v/cps/lib/std/f-cvdmy' USING WS-YYYYMMDD1
              CANCEL '/v/cps/lib/std/f-cvdmy'
              CALL   '/v/cps/lib/std/f-cvdmy' USING WS-YYYYMMDD2
              CANCEL '/v/cps/lib/std/f-cvdmy'.

           IF WS-YYYYMMDD1 > WS-YYYYMMDD2
              COMPUTE LINK-DAY-COUNT = LINK-DAY-COUNT - 1
              GO TO TERMINATION.

           MOVE WS-YYYYMMDD1 TO WS-YYYYMMDD(01).
           MOVE WS-YYYYMMDD2 TO WS-YYYYMMDD(02).

           IF LINK-AGE-TYPE = 1
              PERFORM GET-TOTAL-DAY THRU GET-TOTAL-DAY-END
                   VARYING WS-SUB FROM 1 BY 1 UNTIL WS-SUB > 2
              COMPUTE LINK-DAY-COUNT =
                      WS-DAY-COUNT(2) - WS-DAY-COUNT(1)
           ELSE
              PERFORM GET-TOTAL-DAY2 THRU GET-TOTAL-DAY2-END.

        TERMINATION.
           EXIT PROGRAM.
           STOP RUN.

      ******************************************************************
        GET-TOTAL-DAY.

           DIVIDE WS-YYYY(WS-SUB) BY 4 GIVING WS-LEAP-YEAR-COUNT
                                       REMAINDER WS-REMAIN.  
           
           IF LEAP-YEAR AND WS-MM(WS-SUB) < 3
              SUBTRACT 1 FROM WS-LEAP-YEAR-COUNT.

           MOVE WS-MM(WS-SUB) TO WS-MTH.
           COMPUTE WS-DAY-COUNT(WS-SUB) = WS-YYYY(WS-SUB) * 365 +
                   WS-LEAP-YEAR-COUNT + WS-DAY(WS-MTH) + WS-DD(WS-SUB).

        GET-TOTAL-DAY-END. EXIT.

      ******************************************************************
        GET-TOTAL-DAY2.

           COMPUTE WS-DAY-COUNT(01) = (WS-YYYY(01) * 12) + WS-MM(01).
           COMPUTE WS-DAY-COUNT(02) = (WS-YYYY(02) * 12) + WS-MM(02).

           COMPUTE WS-COMP-MTH = WS-DAY-COUNT(02) - WS-DAY-COUNT(01).
           COMPUTE LINK-DAY-COUNT = (WS-COMP-MTH * 30) + 30.

        GET-TOTAL-DAY2-END. EXIT.

      * End of Program.


 
lrtcoolman
 
Posts: 5
Joined: Thu Mar 02, 2017 3:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: CALLING AND USE PROGRAM FROM LIBRARY

Postby NicC » Thu Mar 02, 2017 5:14 pm

Again, that all points to a non-mainframe environment. I hvae just looked in the COBOL Languag Reference for the z/OS operating system and there is no SCREEN section. So, perhaps you are running on z/Linux but what cobol compiler are you using?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: CALLING AND USE PROGRAM FROM LIBRARY

Postby lrtcoolman » Thu Mar 02, 2017 5:18 pm

yup .. all this program is coded and stored in a Unix server
the compiler I am using > ACUCOBOL-GT

btw, for a basic COBOL program could you show example of calling a subroutine and return calculated value ?
lrtcoolman
 
Posts: 5
Joined: Thu Mar 02, 2017 3:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: CALLING AND USE PROGRAM FROM LIBRARY

Postby NicC » Thu Mar 02, 2017 5:26 pm

Which Unix?

Use the LINKAGE SECTION.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: CALLING AND USE PROGRAM FROM LIBRARY

Postby lrtcoolman » Thu Mar 02, 2017 5:39 pm

This is run in the HPE, so OS installed is HP-UX .
'
How to actually link if I have DDMMYYYY value from USER_CFG and wanna use in GET_AGE then the results pass back to USER_CFG diaplay as AGE ?
lrtcoolman
 
Posts: 5
Joined: Thu Mar 02, 2017 3:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: CALLING AND USE PROGRAM FROM LIBRARY

Postby NicC » Thu Mar 02, 2017 5:43 pm

So you are not on a mainframe. Topic to be locked and deleted.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: CALLING AND USE PROGRAM FROM LIBRARY

Postby lrtcoolman » Thu Mar 02, 2017 5:47 pm

Sorry, I just start to code COBOL since last 2 week. I hope that someone can demo the practice of code.
lrtcoolman
 
Posts: 5
Joined: Thu Mar 02, 2017 3:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: CALLING AND USE PROGRAM FROM LIBRARY

Postby NicC » Thu Mar 02, 2017 5:56 pm

There are plenty of tutorials and books out there.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post