Created On:  14 February 2012

Problem:

The ACUCOBOL-GT C$GETCGI routine retrieves CGI (Common Gateway Interface) variables. The common syntax to use is:

CALL "C$GETCGI"
    USING VARIABLE-NAME, DEST-ITEM, VALUE-INDEX
    GIVING VALUE-SIZE

where VARIABLE-NAME contains the name of the CGI variable that an ACUCOBOL-GT program receives from a HTTP web form.

The syntax is easy to use when CGI variables have this structure:
[FieldA] => 12345
[FieldB] => ABCDE

In these cases, VARIABLE-NAME will contain "FieldA" or "FieldB".

Which is the correct value to use in VARIABLE-NAME when CGI variables have sub-items?
[FieldA]
   [SubFieldA] => ABCDE

Resolution:

A syntax like the following may work, depending on the characters used to identify the sub field in the original web form. 

In this example, the value to use in VARIABLE-NAME will be FieldA[SubFieldA]:

01 WS-VARIABLE-NAME.
  03 FILLER PIC X(6) VALUE "FieldA".
  03 FILLER PIC X(3) VALUE '['.
  03 FILLER PIC X(9) VALUE "SubFieldA".
  03 FILLER PIC X(3) VALUE ']'.

MOVE WS-VARIABLE-NAME TO VARIABLE-NAME

CALL "C$GETCGI"
    USING VARIABLE-NAME, DEST-ITEM, VALUE-INDEX
    GIVING VALUE-SIZE

Incident #2552529