[Stackoverflow] [Progress OpenEdge ABL] Import a progress 4gl file which contains multiple procedure inside a procedure

  • Thread starter Abhinit Kumar Das
  • Start date
Status
Not open for further replies.
A

Abhinit Kumar Das

Guest
In this code , the procedure p-updateCoilStatus is mapped in a rest api . for now the v-xusec in {x\xxxxllogin.i v-xusec} is static . I have assigned a value of "web" to it. I want to send value to v-xusec through the api . For that I need to keep {x\xxxxllogin.i v-xusec} inside the procedue p-updateCoilStatus because the api doesn't look outside the procedure. When I try to keep {x\xxxxllogin.i v-xusec} inside the procedure I get an error saying "YOU CAN NOT NEST PROCEDURES, METHODS AND FUNCTIONS" because x\xxxxllogin.i contains multiple procedure and functions.

I WANT TO MAKE THE VARIABLE v-xusec DYANMIC FROM THE API

Code:
@openapi.openedge.export FILE(type="REST", executionMode="single-run", useReturnValue="false",       writeDataSetBeforeImage="false").

{src\emmDataset.i}
@openapi.openedge.export(type="REST", useReturnValue="false", writeDataSetBeforeImage="false").
procedure p-updateCoilStatus:
define input parameter coilNumber as character no-undo.
define input parameter xusec as character no-undo.
define input-output parameter table for ttCoilRecord.

define variable v-stacDamaged as character no-undo.
define variable v-stacAvailable as character no-undo.
define variable v-oldcoilstatus as character no-undo.
define variable v-newcoilstatus as character no-undo.
define variable v-ocoin as character no-undo.
define variable v-smtpServer as character no-undo.
define variable v-mailTo as character no-undo.
define variable v-mailFrom as character no-undo.

define buffer buff_ocoil for ocoil.

assign 
       v-ocoin         = substring(coilNumber,2,length(coilNumber))
       v-smtpServer    = f-xsysfield("xsystsmtp")
       v-mailTo        = f-xsysfield("dmgControl")
       v-mailFrom      = f-xsysfield("xsystfrom").


find ocoil where ocoil.xlevc = f-xlevc("ocoil") and ocoil.ocoin = integer(v-ocoin) no-lock no-error.
if avail ocoil then 
do:
    assign v-stacDamaged   = f-xstanext('ocoil',ocoil.xstac,10,TRUE,?)
           v-stacAvailable = f-xstanext('ocoil',ocoilxstac,20,TRUE,?)
           v-oldcoilstatus = ocoil.xstac.
    
    find ttCoilRecord no-lock.
    if not available ttCoilRecord then leave.
    
    if (v-oldcoilstatus = v-stacDamaged) or (v-oldcoilstatus = v-stacAvailable) then
    do:
    end.
    else
    do:
        find buff_ocoil where buff_ocoil.xlevc = f-xlevc('ocoil')
                          and buff_ocoil.ocoin = ocoil.ocoin 
                          exclusive-lock.
        assign 
            buff_ocoil.glocc = ttCoilRecord.glocc
            buff_ocoil.xstac = if ttCoilRecord.xstac = "Damaged" then v-stacDamaged  else v-     stacAvailable.
        release buff_ocoil.
    end.
     
     assign v-newcoilstatus = ocoil.xstac.
              
     assign ttCoilRecord.glocc = ocoil.glocc
            ttCoilRecord.xstac = if ocoil.xstac = "225" then "Damaged"  else trim(entry(2,entry(1,f-           xstadisp("ocoil",ocoil.xstac)), "-")).
     end.
     
     if v-newcoilstatus = "225" and v-oldcoilstatus < "225" then
     do:
     end.

end procedure.
}

{x\xxxxllogout.i}

Continue reading...
 
Status
Not open for further replies.
Back
Top