Question Please Help Me To Understand This Line - If Recid(pckc_mstr) = -1 Then.

Please help me to understand this highlited line - if recid(pckc_mstr) = -1 then.

i could see above line in most of existing program withthin conditional block . can anyone help me to understand exact functionality.
 
Last edited:

Cringer

ProgressTalk.com Moderator
Staff member
That looks like a horrible fudge to get around a problem. I can't say what it's trying to achieve but it's not good.
Can you post a complete snippet please for context. I would be searching out the author of the code to ask them the purpose though.
 
That looks like a horrible fudge to get around a problem. I can't say what it's trying to achieve but it's not good.
Can you post a complete snippet please for context. I would be searching out the author of the code to ask them the purpose though.
Please find below,
Code:
createPackCodeLoop:
   do transaction:

      for first pckc_mstr exclusive-lock
         where pckc_domain = global_domain
           and pckc_pack_code = input pckc_pack_code:
      end.

      if not available pckc_mstr then do:
         {us/bbi/pxmsg.i &MSGNUM=1 &ERRORLEVEL=1}
                  
         create pckc_mstr.

         assign
            pckc_mstr.pckc_domain = global_domain
            pckc_first_create = Yes
            pckc_pack_code
            pckc_single_item  = Yes
            pckc_single_lot   = Yes
            pckc_inv_part     = No .
         if recid(pckc_mstr) = -1 then.
    end.
 
Last edited by a moderator:

Rob Fitzpatrick

ProgressTalk.com Sponsor
Is this the actual code? I count three blocks and two END statements.

if recid(pckc_mstr) = -1 then.
IF condition THEN do nothing.

What is this supposed to accomplish?

On a CREATE, the assignment of a rowid to a record may be deferred, unless you use a function like RECID or ROWID which requires the storage engine to allocate space for the record. So it looks to me like recid(pckc_mstr) = -1 is always false. I have no idea what the developer intended.
 

TomBascom

Curmudgeon
I could be wrong but I vaguely recall that that is something QAD did in order to support the Oracle dataserver.
 
Thanks All. i could understand IF condition THEN . do nothing.
I never seen such syntax in my past experience. so i got confused when i see such a line in qad.
Yes Correct. This code snippet from QAD standard module and also i could see similiar logic in different manner in standard programs
Example1: disp skip(2) "End of Report" skip
"Selection Criteria: Ship Date Range From: " l_shpdt no-label " To: " .
if l_shpdt1 = hi_date then.
else disp l_shpdt1 no-label.
Example2:
Code:
DO:
        OUTPUT TO "outputfile.txt".
            put 
            "sampleprogram.p" at 1
            "7.9.16.12 *Missing Shipper Report" at 20
            "Date:" at 60 string(today) at 66
            "Time:" at 75 string(Time,"hh:mm:ss") at 81 skip.
            put "Missing Shipper(s)   Last Shipper         BOL      Next Shipper         BOL" skip.
            put "-------------------- -------------------- -------- -------------------- --------" skip.
            put "NO Missing Shippers" at 1.
            put  skip(2) "End of Report" skip.
            put  "Selection Criteria: Ship Date Range From: " l_shpdt "    To:  ".
            if l_shpdt1 = hi_date then.
            else put l_shpdt1.

        OUTPUT CLOSE.
    END.

 
Last edited by a moderator:

Rob Fitzpatrick

ProgressTalk.com Sponsor
In future please put code within CODE tags to make it more readable.
[ CODE ]
your code
[ /CODE ]
I am showing them here with spaces so you can see them. The actual tags don't contain spaces.
 
Please help me to understand this highlited line - if recid(pckc_mstr) = -1 then.

i could see above line in most of existing program withthin conditional block . can anyone help me to understand exact functionality.

From 2012 peg email:

If my memory serves me right, I believe that is coding logic needed when you
are running against an Oracle database instead of Progress. QAD's
applications, written in Progress, can be run as-is against an Oracle
database. However, Oracle and Progress behave differently when new records
are created. They populate the key fields and commit the record to the
database at different times.

Typically, a statement like "if recid(trgl_det) = -1 then ." would come
immediately after creating the record and assigning the fields that make up
the primary unique key. Then that statement will force the record to be
written/committed to the database, ensuring data integrity and avoiding
record collisions with other newly created records.

When running against a Progress database, those statements do no harm.

Hope that helps,

Tammy Lonsberry
Sr. Programmer/Analyst & QAD Consultant​
 
And from Qad Knowledge database:
glt_det is use by "" on tty ? Wait or press CTRL-C to stop. (121)
Author: Tomasz Bladkowski Article ID: AA-46251 Views: 115 Created: 09-01-2009 11:46 AMLast Updated: 09-01-2009 12:13 PM
fact
: eB2.1 SP7 and below
fact: woworc.p
fact: 16.11 Work Order Receipt
fact: sfoptr01.p
fact: 17.1 Labor Feedback by Work Order
fact: icicpm.p
fact: 3.24 Inventory Control
fact: Oracle database
fact: Journal Reference Method: 20 (or any not standard value)
fact: Few users wants to use same option in the same time.
symptom: glt_det is use by "" on tty ? Wait or press CTRL-C to stop. (121)
symptom: Naruszono wiêzy unikatowe (GLT_REF##GLT_DET)
cause: Under oracle each CREATE glt_det must be ended with "if recid(glt_det) = -1 then." Other wise error can occur.​
 
Top