Page 1 of 1

What is the use of C*variable ?

PostPosted: Thu May 20, 2010 5:53 pm
by diptisaini
01 STORE-MESSAGE VIEW OF INCOMING-MESSAGE-QUEUE
02 COUNTER-PARTY-REFERENCE
02 ERROR-CODE
02 ERROR-MESSAGE
02 RECON-SEQ
02 DATE-RECEIVE
02 TIME-RECEIVE
02 SENDER-ADDRESS
02 RECEIVER-ADDRESS
02 MESSAGE-SOURCE
02 C*MESSAGE-CONTENT
02 MESSAGE-CONTENT (1:100)
02 LAST-CHANGE-USER
02 LAST-CHANGE-DATE
02 LAST-CHANGE-TIME

What is the use of C* variable and why this MESSAGE-CONTENT variable has mentioned 2 times ?

Re: What is the use of C*variable ?

PostPosted: Thu May 20, 2010 10:19 pm
by RGZbrog
The following line tells Adabas to return up to 100 occurrences of the field.
02 MESSAGE-CONTENT (1:100)

This line tells Adabas to return the actual count of the number of occurrences returned, so that you know how many to process.
02 C*MESSAGE-CONTENT
In your code you can use C*MESSAGE-CONTENT like any other numeric variable (with a few limitations).

Re: What is the use of C*variable ?

PostPosted: Fri May 21, 2010 11:15 am
by diptisaini
Can you please explain me C*MESSAGE-CONTENT with a example ?

Re: What is the use of C*variable ?

PostPosted: Fri May 21, 2010 12:11 pm
by RGZbrog
Sure. Here's a stripped-down sample from my Introduction to Natural class. (hint hint, nudge nudge, wink wink ;) ) It uses the standard EMPLOYEE file provided by Software AG.
DEFINE DATA LOCAL
1 EMP    VIEW EMPLOYEES
  2 PERSONNEL-ID (HD='Personnel')
  2 NAME
  2 FIRST-NAME
  2 C*INCOME (HD='C*')
  2 CURR-CODE (10) (HD='Cur')
  2 SALARY (10) (HD='Salary')
1 #C (N3) (HD='Cnt')
END-DEFINE
READ (5) EMP BY PERSONNEL-ID
  ASSIGN #C = C*INCOME
  DISPLAY (ZP=F SG=F ES=T)
          PERSONNEL-ID
          NAME
          FIRST-NAME
          #C
          C*INCOME
          CURR-CODE (*)
          SALARY (*)
END-READ
END

And here is the output:
Page     1                                                   05/20/10  23:38:56

Personnel         NAME              FIRST-NAME      Cnt C*  Cur  Salary
--------- -------------------- -------------------- --- --- --- ---------

11100102  SCHINDLER            EDGAR                  4   4 EUR     24615
                                                            EUR     23589
                                                            EUR     22307
                                                            EUR
11100105  SCHIRM               CHRISTIAN              2   2 EUR     34871
                                                            EUR     33846
11100106  SCHMITT              REINER                 4   4 EUR     26153
                                                            EUR     24358
                                                            EUR     23076
                                                            EUR     22051
11100107  SCHMIDT              HELGA                  2   2 EUR     18461
                                                            EUR     16410
11100108  SCHNEIDER            WOLFGANG               4   4 EUR     22564
                                                            EUR     21538
                                                            EUR     20000
                                                            EUR     18974

Re: What is the use of C*variable ?

PostPosted: Fri May 21, 2010 1:13 pm
by diptisaini
1)Can we write C* in place of C*INCOME ?
Personnel NAME FIRST-NAME Cnt C* Cur Salary
--------- -------------------- -------------------- --- --- --- ---------

11100102 SCHINDLER EDGAR 4 4 EUR 24615
EUR 23589
EUR 22307
EUR

2)In salary colum only 3 values are populated so value of C*INCOME should be 3 but you have mentioned it as 4 . can you please exlain me this ?

Re: What is the use of C*variable ?

PostPosted: Fri May 21, 2010 2:13 pm
by RGZbrog
1) No, C* can be used only as a prefix of an MU or PE. The display header shows C* only because I specified 'C*' as the header value (HD parameter).

2) There are four values. INCOME is composed of two fields - SALARY and CURR-CODE. The fourth occurrence of INCOME contains EUR and 0.

Re: What is the use of C*variable ?

PostPosted: Fri May 21, 2010 2:41 pm
by diptisaini
Thanks a alott for clearing my doubt.