Maintain Sequences with the ABL? - Forum - OpenEdge Development - Progress Community
 Forum

Maintain Sequences with the ABL?

This question is answered

Is there a safe/reliable way to maintain Sequences with the ABL?

Is there a Progress provided utility that can be called?

Is it as simple as creating/updating the _sequence table?

What are the gotchas to be aware of?

TIA.

Verified Answer
  • What exactly are you trying to do?
     
    Is that for deployment? We dump and load sequences using the
     
    prodict/dump/_lodseqs.p and
    prodict/dump/_dmpseqs.p
     
    procedures of the data dictionary.
     
    This is a procedure we are using from PCT/ANT scripts:
     
    ROUTINE-LEVEL ON ERROR UNDO, THROW.
     
    /* Dictionary variables */
     
    {Consultingwerk/Studio/user-env.i NEW}
     
    DEFINE NEW SHARED VARIABLE user_dbname AS CHARACTER NO-UNDO .
     
    DEFINE NEW SHARED STREAM logfile.
     
    DEFINE NEW SHARED VARIABLE drec_db AS RECID INITIAL ? NO-UNDO.
     
    DEFINE NEW SHARED TEMP-TABLE tt_cache_file NO-UNDO
        FIELD nPos        AS INTEGER
        FIELD cName       AS CHARACTER
        FIELD p_flag      AS LOGICAL
     
    /* Mike Fechner, Consultingwerk Ltd. 20.02.2013
       new tt field in 11.0 */
    &IF NOT PROVERSION BEGINS "10":U &THEN
        FIELD multitenant  AS LOGICAL
    &ENDIF
        INDEX nPos IS UNIQUE PRIMARY nPos
        INDEX cName cName.
     
    DEFINE VARIABLE cSourceFile AS CHARACTER NO-UNDO.
     
    /* ***************************  Main Block  *************************** */
     
    ASSIGN cSourceFile = DYNAMIC-FUNCTION("getParameter":U IN SOURCE-PROCEDURE, INPUT "SourceFile":U) .
     
    Consultingwerk.Assertion.Assert:NotNullOrEmpty (cSourceFile) .
     
    ASSIGN drec_db      = Consultingwerk.Util.DatabaseHelper:GetDictDbRecid()
           user_dbname  = LDBNAME ("DICTDB":U)
     
           user_env[2]  = cSourceFile
           /*user_env[5] = pcCodePage.*/
           user_envDevil  = "no-alert-boxes":U
     
           user_env[10] = "UNDEFINED":U .
     
    RUN prodict/dump/_lodseqs.p.
     
    ERROR-STATUS:ERROR = NO .
     
    RETURN "0":U .
     
    /* Mike Fechner, Consultingwerk Ltd. 07.07.2013
       Catch unhandled error, this would be a runtime error */
    CATCH err AS Progress.Lang.Error :
        MESSAGE "Unhandled error:":U SKIP
                Consultingwerk.Util.ErrorHelper:FormattedErrorMessagesExt (err) .
     
        RETURN "1":U . /* signal erorr */
    END CATCH.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • if you use the dictionary tool interactively to create one sequence and then dump it, you will see what the required format is for mike's code that does "run prodict/dump/_lodseqs.p." .

All Replies
  • What exactly are you trying to do?
     
    Is that for deployment? We dump and load sequences using the
     
    prodict/dump/_lodseqs.p and
    prodict/dump/_dmpseqs.p
     
    procedures of the data dictionary.
     
    This is a procedure we are using from PCT/ANT scripts:
     
    ROUTINE-LEVEL ON ERROR UNDO, THROW.
     
    /* Dictionary variables */
     
    {Consultingwerk/Studio/user-env.i NEW}
     
    DEFINE NEW SHARED VARIABLE user_dbname AS CHARACTER NO-UNDO .
     
    DEFINE NEW SHARED STREAM logfile.
     
    DEFINE NEW SHARED VARIABLE drec_db AS RECID INITIAL ? NO-UNDO.
     
    DEFINE NEW SHARED TEMP-TABLE tt_cache_file NO-UNDO
        FIELD nPos        AS INTEGER
        FIELD cName       AS CHARACTER
        FIELD p_flag      AS LOGICAL
     
    /* Mike Fechner, Consultingwerk Ltd. 20.02.2013
       new tt field in 11.0 */
    &IF NOT PROVERSION BEGINS "10":U &THEN
        FIELD multitenant  AS LOGICAL
    &ENDIF
        INDEX nPos IS UNIQUE PRIMARY nPos
        INDEX cName cName.
     
    DEFINE VARIABLE cSourceFile AS CHARACTER NO-UNDO.
     
    /* ***************************  Main Block  *************************** */
     
    ASSIGN cSourceFile = DYNAMIC-FUNCTION("getParameter":U IN SOURCE-PROCEDURE, INPUT "SourceFile":U) .
     
    Consultingwerk.Assertion.Assert:NotNullOrEmpty (cSourceFile) .
     
    ASSIGN drec_db      = Consultingwerk.Util.DatabaseHelper:GetDictDbRecid()
           user_dbname  = LDBNAME ("DICTDB":U)
     
           user_env[2]  = cSourceFile
           /*user_env[5] = pcCodePage.*/
           user_envDevil  = "no-alert-boxes":U
     
           user_env[10] = "UNDEFINED":U .
     
    RUN prodict/dump/_lodseqs.p.
     
    ERROR-STATUS:ERROR = NO .
     
    RETURN "0":U .
     
    /* Mike Fechner, Consultingwerk Ltd. 07.07.2013
       Catch unhandled error, this would be a runtime error */
    CATCH err AS Progress.Lang.Error :
        MESSAGE "Unhandled error:":U SKIP
                Consultingwerk.Util.ErrorHelper:FormattedErrorMessagesExt (err) .
     
        RETURN "1":U . /* signal erorr */
    END CATCH.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • if you use the dictionary tool interactively to create one sequence and then dump it, you will see what the required format is for mike's code that does "run prodict/dump/_lodseqs.p." .

  • Thank you! That should do it.