Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Examples of individual KDCS calls

This section includes examples of code for the following KDCS calls:

  • MGET

  • MPUT

  • DPUT

  • MCOM with DPUT in a job complex

  • APRO with MPUT for distributed processing

Since the other KDCS calls are coded in a similar manner, they are not all illustrated explicitly at this point in the manual.

In a KDCS call, KCPAC indicates the address of the KDCS parameter area and NB the address of the message area. It is assumed that you are using the COPY member KCOPC (constants for the operation codes).

MGET call

  • An unformatted dialog message that is exactly 80 bytes long is to be received. If less than 80 characters are read, a prompt for re-entry of the message is to be issued.

    ...
    MOVE LOW-VALUE TO KCPAC.
    MOVE MGET   TO KCOP.
    MOVE 80     TO KCLA.
    MOVE SPACES TO KCMF.
    CALL "KDCS" USING KCPAC, NB.
     IF KCRCCC NOT = ZERO
       THEN PERFORM MGET-RETURN-CODE.  1)
     IF KCRLM NOT = KCLA
       THEN PERFORM ITERATION.         2)
    

    1) If more than 80 characters are read, error handling is activated.

    2) The routine ITERATION sends a prompt to the terminal requesting that the entry be repeated.

  • An ongoing service may receive input that consists of a short message generated with the function key F2 followed by 10 characters of data. This input is intended to trigger a special function. The F2 key was assigned the return code 21Z during generation.

      ...
      MOVE LOW-VALUE TO KCPAC.
      MOVE MGET TO KCOP.
        .
      CALL "KDCS" USING KCPAC, NB.
      IF KCRCCC = "21Z"                   1)
         THEN PERFORM MGET-2.
      ...
     MGET-2.                              2)
      MOVE LOW-VALUE TO KCPAC.
      MOVE MGET   TO KCOP.
      MOVE 10     TO KCLA.
      MOVE SPACES TO KCMF.
      CALL "KDCS" USING KCPAC, NB.
      IF KCRCCC NOT = ZERO
         THEN PERFORM MGET-RETURN-CODE.
    

    1) A special function is called.

    2) An additional MGET is needed for the 10 characters of data.

BS2000 systems

  • The format "PIC15" has been requested by a terminal. The unprotected data is 500 characters long in various different format fields. This format is to be received by the program.

    ...
    MOVE LOW-VALUE TO KCPAC.
    MOVE MGET       TO KCOP.
    MOVE 500        TO KCLA.
    MOVE "*PIC15 "  TO KCMF.
    CALL "KDCS" USING KCPAC, IPIC15.
    IF KCRCCC = "05Z" GO TO FORMAT-ERROR.      1)
    IF KCRCCC NOT = ZERO GO TO MGET-RETURN-CODE.
    ...
    

    1) In the routine ’FORMAT-ERROR’, the format has to be output again to enable you to continue working with the correct format.

MPUT call

  • An 80-byte long unformatted message is to be sent to the terminal.

       ...
       MOVE LOW-VALUE TO KCPAC.
       MOVE MPUT   TO KCOP.
       MOVE "NE"   TO KCOM.
       MOVE 80     TO KCLM.
       MOVE SPACES TO KCRN.
       MOVE SPACES TO KCMF.
       MOVE ZERO   TO KCDF.
       CALL "KDCS" USING KCPAC, NB.
       IF KCRCCC NOT = ZERO
          THEN PERFORM MPUT-RETURN-CODE.
    

BS2000 systems

  • A 500-byte long formatted message is to be sent to the terminal. The name of the format is “PIC15”. The screen is to be deleted before the message is sent.

        ...
        MOVE LOW-VALUE TO KCPAC.
        MOVE MPUT      TO KCOP.
        MOVE "NE"      TO KCOM.
        MOVE 500       TO KCLM.
        MOVE SPACES    TO KCRN.
        MOVE "*PIC15"  TO KCMF.
        MOVE KCREPL    TO KCDF.           1)
        CALL "KDCS" USING KCPAC, NB.
        IF KCRCCC NOT = ZERO
           THEN PERFORM MPUT-RETURN-CODE.
    

    1) REPLACE is executed by default whenever a format is replaced. The output is generated to preclude the possibility of errors resulting from undefined field contents.

  • In a *format called "PIC10" which, according to the most recent terminal input, still exists, all unprotected fields are to be deleted by way of a response.

    ...
    MOVE LOW-VALUE TO KCPAC.
    MOVE MPUT      TO KCOP.
    MOVE "NE"      TO KCOM.
    MOVE ZEROES    TO KCLM.
    MOVE SPACES    TO KCRN.
    MOVE "*PIC10"  TO KCMF.
    MOVE KCERAS    TO KCDF.
    CALL "KDCS" USING KCPAC, NB.
    IF KCRCCC NOT = ZERO
       THEN PERFORM MPUT-RETURN-CODE.
    

DPUT call

  • An asynchronous job with an 11-character long message is to be passed on November 11 (= the 315th day of the year) at 11.11 a.m. to a program unit (absolute time specification). The relevant TAC is "ALAAF".

    ...
    MOVE LOW-VALUE TO KCPAC.
    MOVE DPUT    TO KCOP.
    MOVE "NE"    TO KCOM.
    MOVE 11      TO KCLM.
    MOVE "ALAAF" TO KCRN.
    MOVE ZERO    TO KCDF.
    MOVE SPACES  TO KCMF.
    MOVE "A"     TO KCMOD.
    MOVE "315"   TO KCTAG.
    MOVE "11"    TO KCSTD.
    MOVE "11"    TO KCMIN.
    MOVE "00"    TO KCSEK.
    CALL "KDCS" USING KCPAC, NB.
    IF KCRCCC NOT = ZERO
       THEN PERFORM DPUT-RETURN-CODE.
    
  • An 80-character long message is to be output to the terminal ’DSS1’ one hour from now (relative time specification), whereupon the screen function ’acoustic alarm’ (BEL) is to be triggered.

    ...
    MOVE LOW-VALUE TO KCPAC.
    MOVE DPUT       TO KCOP.
    MOVE "NE"       TO KCOM.
    MOVE 80         TO KCLM.
    MOVE "DSS1    " TO KCRN.
    MOVE SPACES     TO KCMF.
    MOVE KCALARM    TO KCDF.
    MOVE "R"        TO KCMOD.
    MOVE "000"      TO KCTAG.
    MOVE "01"       TO KCSTD.
    MOVE "00"       TO KCMIN.
    MOVE "00"       TO KCSEK.
    CALL "KDCS" USING KCPAC, NB.
    IF KCRCCC NOT = ZERO
       THEN PERFORM DPUT-RETURN-CODE.
    

Job complex: MCOM and DPUT calls

A formatted asynchronous message (of 200 bytes) is to be printed out at 6.00 p.m. (= 18.00 hours) on the same day on PRINTER2. The confirmation returned by the printer is to be handled by a program.

If positive confirmation is returned, an asynchronous program with the TAC PRINTPOS receives a confirmation job with a 20-byte long message. If negative confirmation is returned, an asynchronous program with the TAC PRINTNEG is started (without a
message). 80 bytes of user information is also logged in the event of negative confirmation. This information can be read with DADM UI as soon as the confirmation job becomes the main job. Confirmation jobs cannot be addressed by means of a job ID.

The job complex is encapsulated within two MCOM calls, which determine the destinations for the print job (= the basic job) and confirmation jobs in the MCOM BC call; the complex ID is "*PRICOMP".


    ...
COMPLEX-BEGIN.
    MOVE LOW-VALUE  TO KCPAC.
    MOVE MCOM       TO KCOP.
    MOVE BC         TO KCOM.
    MOVE "PRINTER2" TO KCRN.
    MOVE "PRINTPOS" TO KCPOS.
    MOVE "PRINTNEG" TO KCNEG.
    MOVE "*PRICOMP" TO KCCOMID.
    CALL "KDCS" USING KCPAC.
    IF KCRCCC NOT = ZERO
       THEN PERFORM MCOM-RETURN-CODE.
DPUT-NE.
    MOVE DPUT       TO KCOP.
    MOVE "NE"       TO KCOM.
    MOVE 200        TO KCLM.
    MOVE "*PRICOMP" TO KCRN.
    MOVE "*FORM1"   TO KCMF. *** (only on BS2000 systems)
    MOVE ZERO       TO KCDF.
    MOVE "A"        TO KCMOD.
    MOVE KCTJHVG    TO KCTAG.
    MOVE "18"       TO KCSTD.
    MOVE "00"       TO KCMIN.
    MOVE "00"       TO KCSEK.
    CALL "KDCS" USING KCPAC, NB1.
    IF KCRCCC NOT = ZERO
       THEN PERFORM DPUT-RETURN-CODE.
DPUT-PLUS-T.
***************************************************************
* Confirmation job in positive case
***************************************************************
     MOVE LOW-VALUE  TO KCPAC.
     MOVE DPUT       TO KCOP.
     MOVE "+T"       TO KCOM.
     MOVE 20         TO KCLM.
     MOVE "*PRICOMP" TO KCRN.
     MOVE SPACES     TO KCMF.
     MOVE ZERO       TO KCDF.
     CALL "KDCS" USING KCPAC, NB2.
     IF KCRCCC NOT = ZERO
        THEN PERFORM DPUT-RETURN-CODE.
 DPUT-USER-INFO.
***************************************************************
* User information for negative case
***************************************************************
     MOVE LOW-VALUE  TO KCPAC.
     MOVE DPUT       TO KCOP.
     MOVE "-I"       TO KCOM.
     MOVE 80         TO KCLM.
     MOVE "*PRICOMP" TO KCRN.
     MOVE SPACES     TO KCMF.
     MOVE ZERO       TO KCDF.
     CALL "KDCS" USING KCPAC, NB3.
     IF KCRCCC NOT = ZERO
        THEN PERFORM DPUT-RETURN-CODE.
 DPUT-MINUS-T.
***************************************************************
* Confirmation job in negative case
***************************************************************
     MOVE LOW-VALUE  TO KCPAC.
     MOVE DPUT       TO KCOP.
     MOVE "-T"       TO KCOM.
     MOVE ZERO       TO KCLM.
     MOVE "*PRICOMP" TO KCRN.
     MOVE SPACES     TO KCMF.
     MOVE ZERO       TO KCDF.
     CALL "KDCS" USING KCPAC, NB4.
     IF KCRCCC NOT = ZERO
        THEN PERFORM DPUT-RETURN-CODE.
 COMPLEX-END.
     MOVE LOW-VALUE  TO KCPAC.
     MOVE MCOM       TO KCOP.
     MOVE EC         TO KCOM.
     MOVE "*PRICOMP" TO KCCOMID.
     CALL "KDCS" USING KCPAC.
     IF KCRCCC NOT = ZERO
        THEN PERFORM MCOM-RETURN-CODE.
     .
     .

Example of distributed processing: APRO call with a subsequent MPUT

The job-submitting service is to address the dialog service with the transaction code ’LTAC1’ for the application ’PARTNER1’ (double-step addressing). In this context, the jobreceiving service is to be assigned the service ID ’>VGID1’. A 100-byte long MPUT message is then to be sent in line mode to the partner application.

...
MOVE LOW-VALUE  TO KCPAC.
MOVE APRO       TO KCOP.
MOVE "DM"       TO KCOM.
MOVE ZERO       TO KCLM.
MOVE "LTAC1   " TO KCRN.
MOVE "PARTNER1" TO KCPA.
MOVE ">VGID1  " TO KCPI.
CALL "KDCS" USING KCPAC.
IF KCRCCC NOT = ZERO
   THEN PERFORM APRO-RETURN-CODE.
...
MOVE LOW-VALUE  TO KCPAC.
MOVE MPUT     TO KCOP.
MOVE "NE"     TO KCOM.
MOVE 100      TO KCLM.
MOVE ">VGID1" TO KCRN.
MOVE SPACES   TO KCMF.
MOVE ZEROES   TO KCDF.
CALL "KDCS" USING KCPAC, NB.
IF KCRCCC NOT = ZERO
   THEN PERFORM MPUT-RETURN-CODE.