/*********************************REXX**********************************
* Display and edit the broadcast messages *
* Paul Lemons 12/5/99 original code
* Paul Lemons 06/8/00 correction to prevent messages from being out of order
* If messages exist then an edit screen will display existing messages
* If no messages exist then a default screen will be displayed
* In either case whatever is saved can be used to update the broadcast
* dataset. A prompt will verify whether or not to make changes.
***********************************************************************/
Trace off
msg_status=msg('off')
Call outtrap "LINE."
listbc notices
Call outtrap "OFF"
If line.0 > 0 then do
rline = line.0
cnt = 0
do until cnt = rline
cnt = cnt + 1
if words(sysl.cnt) > 0 then do
line.cnt = strip(line.cnt,l,' ')
end
end
end
exist = 'yes'
If line.0 = 0 then do
exist = 'no'
line.0 = 1
line.1 = ' '
end
eddsn = space(mvsvar('sysname') .bcedit.temp.file,0)
eddsn = "'"eddsn"'"
x = sysdsn(eddsn)
if x = ok then "delete ("eddsn")"
"free f(brddtmp)"
"alloc f(brddtmp) da("eddsn") new space(1,1) track lrecl(80) recfm(f)"
address ispexec "lminit dataid(dataid) ddname(brddtmp)"
address ispexec "lmfree dataid("dataid")"
"execio" line.0 "diskw brddtmp (stem line. finis)"
address ispexec "lminit dataid(dataid) ddname(brddtmp)"
if exist = 'no' then
address ispexec "edit dataid("dataid") macro(bceditm1)"
if exist = 'yes' then
address ispexec "edit dataid("dataid") macro(bceditm2)"
address ispexec "lmfree dataid("dataid")"
"execio * diskr brddtmp (stem sysl. finis"
say 'BCEDIT001I - Update or Cancel? (U/C) CANCEL is the default'
parse pull reply
if substr(reply,1) = 'U' ³ substr(reply,1) = 'u' then do
"CONSOLE ACTIVATE"
if rc >= 4 then do
say 'BCEDIT003E - Unable to activate console'
msg_status=msg('on')
return 12
end
GETCODE = GETMSG('CONSMSG.','SOL','XXXS0001',,3)
"CONSPROF SOLDISP(NO) SOLNUM(400)"
IF rline > 0 THEN DO cnt = 1 to rline
"CONSOLE SYSCMD(se "cnt",delete) CART('CONS0001')"
msgrett = getmsg('dmsg','sol','CONS0001',,1)
END
IF sysl.0 > 0 THEN DO cnt = 1 to sysl.0
IF WORDS(sysl.cnt) > 0 THEN do
"CONSOLE SYSCMD(se '"sysl.cnt"',save) CART('CONS0001')"
msgrett = getmsg('dmsg','sol','CONS0001',,1)
END
END
"CONSOLE DEACTIVATE"
say 'BCEDIT004I - Broadcast Messages updated'
msg_status=msg('on')
return
end
msg_status=msg('on')
say 'BCEDIT002I - update cancelled'
return