I want a Cobol sample to Write a C5 record in PLOG

Hi :

Could you provide me a Cobol (or Natural) sample program that writes a C5 record in PLOG ?

Thanks in advance
Francisco

Hello Francisco,

issuing a C5 call is very simple.

Just set the command code and record buffer length in the Adabas control block and put some data into the Adabas record buffer that you want to write to the protection log.

If you work with replication you might want to set file number, option1 = ‘R’ and subsciption name into additions1.

As an example a working adapya code snippet:


from adabas.api import Adabas
a=Adabas(rbl=24)                       # allocate Adabas cb/rb
a.cb.cmd='C5'                          # set command code to C5
a.cb.dbid=8

# the following 3 lines are optional if you want to replicate the C5
a.cb.fnr=11
a.cb.op1='R'
a.cb.ad1='EMPLSUB'                     # replication subscription

# Record buffer set to some meaningful data that you will
# be finding in the PLOG. The data is encoded in EBCDIC because
# buffer will not be converted coming from ASCII machine.

a.rb.value='After batch update 4711.'.encode('IBM037')

# issue the Adabas call
a.call()

This gives the following result in the PLOG (ADAPLP):


3. (Block header)
Len       Block-#  Sess V  Size     DBID Timestamp        Fl ID
01B4 0000 00000009 01BD C9 0000012C 0008 C3244EAB4591B089 80 0000 62000000

Len  BEFZ     In Ty User-ID               Fnr  Add1------------- Trn-Seq#
                    Communication-ID
0056 00000D1E 81 20 0000000000000000 0000 000B C5D4D7D3 E2E4C240 00000001
                    0121000000000000D5C5E360E6D6D9D2DDF40001D7C3D4D4F0F14040

     *After batch upda*  C186A38599408281A3838840A4978481   0000
     *te 4711.*          A38540F4F7F1F14B                   0010

Remote call from PC via WCL and NET-WORK/TCPX to z/OS database.

HTH,
Marbod Mueller :wink: