Post by V***@SendSpamHere.ORGI found an old post from Hein wherein he showed how to call SMG$CREATE_MENU.
I'll hand that off to the customer.
I'm not writing COBOL, the client is. I just need a list of strings from
their programs. I looked at Hein's and Richard's examples -- More PICs
than I can put on my 128GB CF cards -- and I still don't quite grasp all
of the lingo.
Should be straight forward for anyone who's ever used smg$: -
identification division.
program-id. pull_down_menu.
data division.
working-storage section.
01 array_desc.
03 element_len pic 9(4) comp
value 16.
03 dtype pic x
value x"0e".
03 dclass pic x
value x"04".
03 data_pointer pointer
value reference choices.
03 pic 9(4) comp.
03 flags pic x
value low-value.
03 dimct pic x
value x"01".
03 total_bytes pic 9(9) comp
value 320.
03 element_zero pic 9(9) comp.
03 stride pic 9(9) comp
value 20.
03 lwr_b pic 9(9) comp
value 1.
03 upr_b pic 9(9) comp
value 20.
01 choices.
03 pic x(16)
value "one".
03 pic x(16)
value "two".
03 pic x(16)
value "three".
03 pic x(16)
value "four".
03 pic x(16)
value "five".
03 pic x(16)
value "six".
03 pic x(16)
value "seven".
03 pic x(16)
value "eight".
03 pic x(16)
value "nine".
03 pic x(16)
value "ten".
03 pic x(16)
value "eleven".
03 pic x(16)
value "twelve".
03 pic x(16)
value "thirteen".
03 pic x(16)
value "fourteen".
03 pic x(16)
value "fifteen".
03 pic x(16)
value "sixteen".
03 pic x(16)
value "seventeen".
03 pic x(16)
value "eighteen".
03 pic x(16)
value "nineteen".
03 pic x(16)
value "twenty".
*
01 tm_desc.
03 pic 9(9) comp
value 32.
03 pointer
value reference terminator_mask.
01 terminator_mask.
03 pic 9(9) comp
occurs 8.
*+
* COBOL is a bit untidy when it comes to byte data
*_
01 cvt_num pic 9(4) comp.
01 cvt_char redefines cvt_num.
03 active_byte pic x.
03 pic x.
*_
01 pasteboard_id pic 9(9)
comp.
01 keyboard_id pic 9(9) comp.
01 menu_display pic 9(9)
comp.
01 screen_display pic 9(9)
comp.
01 row_cnt pic 9(9)
comp.
01 col_cnt pic 9(9)
comp.
01 menu_rows pic 9(9) comp.
01 menu_cols pic 9(9) comp.
01 option pic 9(4)
comp.
01 option_string pic x(16).
01 default_choice pic 9(4)
comp value 15.
01 terminator pic 9(4) comp.
01 sys_status pic 9(9) comp.
01 ss$_normal pic 9(9) comp
value external ss$_normal.
01 lib$_strtru pic 9(9) comp
value external lib$_strtru.
01 smg$_eof pic 9(9) comp
value external smg$_eof.
01 smg$_invarg pic 9(9) comp
value external smg$_invarg.
01 smg$m_keep_contents pic 9(9) comp
value external smg$m_keep_contents.
01 smg$m_remove_item pic 9(9) comp
value external smg$m_return_immed.
01 smg$m_bold pic 9(9) comp
value external smg$m_bold.
01 smg$m_reverse pic 9(9)
comp value external smg$m_reverse.
01 smg$m_border pic 9(9)
comp value external smg$m_border.
01 smg$m_fixed_format pic 9(9) comp
value external smg$m_fixed_format.
01 smg$k_vertical pic 9(9)
comp value external smg$k_vertical.
01 smg$m_cursor_on pic 9(9)
comp value external smg$m_cursor_on.
01 smg$m_cursor_off pic 9(9) comp
value external smg$m_cursor_off.
01 ctrl_key pic x(4).
procedure division.
00.
subtract element_len from data_pointer giving element_zero.
call "smg$create_pasteboard"
using pasteboard_id, omitted, row_cnt,
col_cnt, smg$m_keep_contents
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value
sys_status.
call "smg$create_virtual_keyboard" using keyboard_id giving
sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value
sys_status.
call "smg$create_virtual_display"
using row_cnt, col_cnt, screen_display
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value
sys_status.
move 1 to row_cnt, col_cnt.
call "smg$paste_virtual_display"
using screen_display, pasteboard_id,
row_cnt, col_cnt
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value
sys_status.
move 20 to menu_cols.
move 10 to menu_rows.
call "smg$create_virtual_display"
using menu_rows, menu_cols,
menu_display, smg$m_border, smg$m_bold
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value
sys_status.
call "smg$label_border"
using by reference menu_display
by descriptor "selection window"
by value 0, 0
by reference smg$m_reverse, smg$m_bold
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value
sys_status.
move 2 to menu_rows.
call "smg$create_menu"
using menu_display, array_desc, smg$k_vertical,
smg$m_fixed_format, menu_rows
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value
sys_status.
move 10 to menu_cols.
call "smg$paste_virtual_display"
using menu_display, pasteboard_id,
menu_rows, menu_cols
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value
sys_status.
call "smg$set_cursor_mode" using pasteboard_id, smg$m_cursor_off
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value
sys_status.
perform with test after until sys_status not = ss$_normal
call "smg$select_from_menu"
using by reference keyboard_id, menu_display, option,
by reference default_choice, smg$m_remove_item
by value 0, 0
by reference terminator
by descriptor option_string
by reference smg$m_reverse, smg$m_bold
giving sys_status
display "term = " terminator with conversion
end-perform.
if sys_status not = ss$_normal call "lib$stop" using by value
sys_status.
* if sys_status not = smg$_eof and smg$_invarg call "lib$stop" using
by value sys_status.
call "smg$set_cursor_mode" using pasteboard_id, smg$m_cursor_on
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value
sys_status.
call "smg$delete_virtual_display" using menu_display giving
sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value
sys_status.
call "smg$delete_virtual_display" using screen_display giving
sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value
sys_status.
stop run.
end program pull_down_menu.