In this section you will find examples of code for the following KDCS calls:
MGET
MPUT
DPUT
MCOM with DPUT in a job complex
APRO with MPUT for distributed processing
Because the rest of the KDCS calls are programmed analogously, we will not explicitly present all of the calls.
In a KDCS call &pa designates the address of the KDCS parameter area and &ma the address of the KDCS message area.
MGET call
An unformatted, 80 byte long dialog message is to be received. If the message received is too short due to an error, then a request for new input is sent.
KDCS_MGET (&ma,80,KDCS_SPACES); if (KCRCC != 0) mget_error(); if ( pa.kcla > ca->ca_return.kcrlm) r_mput ();
In the r_mput () routine a request to repeat the input is sent to the terminal with MPUT.
In a running service an input which consists of a short message, created with the F2 function key, as well as 10 characters of data can be entered. The input should trigger a special function. The F2 key was assigned the 21Z return code during generation.
KDCS_MGET (&ma,input_lth,dev.features); if (KCRCC == 21 ) { /* return code for F2 */ KDCS_MGET (&ma,10,KDCS_SPACES); if (KCRCC != 0 ) mget_error(); }
BS2000 systems
The "FORM15" format was requested by a terminal. The length of the unprotected data is 500 characters in various format fields. This format should be received in the program. FORM15 was declared as a std_mask in the program.
KDCS_MGET (&ma.std_mask,500,"*FORM15 "); if (KCRCC == 5) /* invalid format ID */ format_error(); if (KCRCC != 0) mget_error();
In the format_error routine the format must be output again in order to continue working with the correct format.
MPUT call
An unformatted, 80 byte long UTM message is to be sent to the terminal.
KDCS_MPUTNE (&ma,80,KDCS_SPACES,KDCS_SPACES,KCNODF); if (KCRCC != 0 ) mput_error();
BS2000 systems
The last UTM message in a service is to be sent to a terminal in the format mode. The name of the *format is "FORM15". The screen should be cleared beforehand.
KDCS_MPUTNE (&ma,500,KDCS_SPACES,"*FORM15 ",KCREPL); if (KCRCC != 0 ) mput_error();
REPLACE is executed by default during a format change. The output is performed in order to rule out the possibility of an error due to the undefined contents of a field.
In a "FORM10" *format that is still on the terminal according to the last input, all unprotected fields are to be erased as a result.
. KDCS_MPUTNE (&ma,0,KDCS_SPACES,"*FORM10 ",KCERAS); if (KCRCC != 0 ) mput_error();
DPUT call
A queued job with an 11 character long UTM message is to be sent on Nov.11 (= 315th day of the year) at 11:11 AM to a program unit (absolute time). The TAC name is "ALAAF".
KDCS_DPUTNE (&ma,11,"ALAAF ",KDCS_SPACES,0,'A',315,11,11,0); if (KCRCC != 0 ) /* A = absolute time */ dput_error();
BS2000 systems
An 80 character long queued message is to be output on terminal ’DSS1’ in 1 hour (relative time). The ’acoustic alarm’ (BEL) screen function should be triggered when the message is output.
KDCS_DPUTNE (&ma,80,"DSS1 ",KDCS_SPACES,KCALARM,'R',0,1,0,0); if (KCRCC != 0 ) /* R = relative time */ dput_error();
Job complex: MCOM and DPUT call
A formatted queued message (200 bytes) is to be sent to the printer PRINTER2 on the same day at 18:00. The printer confirmation is handled in the program.
For a positive confirmation an asynchronous program receives a confirmation job using the PRINTPOS TAC with a 20 byte long message, for a negative confirmation an asynchronous program is started with the TAC PRINTNEG (without a message). For a negative confirmation an 80-byte piece of user information is logged; it can be read using DADM UI.
The job complex is framed by two MCOM calls; the target of the print job (=base job) and confirmation jobs are set in the call MCOM BC; the complex identification is "*PRICOMP".
/* Begin of the complex */ KDCS_MCOMBC ("PRINTER2","PRINTPOS","PRINTNEG","*PRICOMP"); if (KCRCC != 0 ) mcom_error(); /* DPUT-message for printer */ KDCS_DPUTNE (&ma1,200,"*PRICOMP","*FORM1 ",KCNODF,'A', ca->ca_head->kccv_doy,18,0,0); if (KCRCC != 0 ) dput_error(); /* acknowledgment job in positive case */ KDCS_DPUTPT (&ma2,20,"*PRICOMP"); if (KCRCC != 0 ) dput_error(); /* User information in negative case */ KDCS_DPUTMI (&ma3,80,"*PRICOMP"); if (KCRCC != 0 ) dput_error(); /* acknowledgment job in negative case */ KDCS_DPUTMT (&ma2,0,"*PRICOMP"); if (KCRCC != 0 ) dput_error(); /* End of complex */ KDCS_MCOMEC ("*PRICOMP"); if (KCRCC != 0 ) mcom_error();
Distributed processing: APRO call followed by MPUT
The dialog service is to be addressed by the job-submitting service with the ’LTAC1’ transaction code of the application ’PARTNER1’ (two stage addressing). The job-receiving service will be assigned the service identification ’>VGID1’. Finally, a 100 byte long MPUT message is sent to the partner application in line mode.
KDCS_APRODM ("LTAC1 ","PARTNER1",">VGID1 "); if (KCRCC != 0 ) apro_error(); ... KDCS_MPUTNE (&ma,100,">VGID1 ",KDCS_SPACES,KCNODF); if (KCRCC != 0 ) mput_error();