RDSEQ NOT READING LINE CORRECTLY

SOLVED

Hi, 

We are planning on upgrading our system from V11 to V12 P29. One thing I noticed is that sage is not able to detect a new line when reading the trace file. When I read the trace file, sage thinks that everything is in 1 line when it is not. Is anybody else experiencing this issue? Does anybody have any ideas on what I can possibly try to resolve it?

Subprog EXECIML(IMPTEMP, FNAME, MESSAGE)

Value Char IMPTEMP
Value Char FNAME

Variable Char MESSAGE () ()

# Start the trace
Call OUVRE_TRACE ("EXECIML "-IMPTEMP) From LECFIC

Call IMPORTSIL(IMPTEMP, FNAME) From GIMPOBJ

# end/write the trace
Call FERME_TRACE From LECFIC

# open the trace file to get the details
Openi filpath("TRA",GTRACE,"tra",0) Using [ZZZ]

Local Integer I : I = 0
Local Integer LISTMAX : LISTMAX = 100

Local Char XLINE(100)
# read the file
Repeat

Rdseq XLINE Using [ZZZ]

If left$(XLINE,11)="Creation of"
MESSAGE = 'SUCCESS'
Openi Using [ZZZ]
End
Elsif left$(XLINE,59)=" You must finish this control in order to access this stock"
MESSAGE = left$(XLINE,59)
Openi Using [ZZZ]
End
Elsif left$(XLINE,2)="<0"
MESSAGE = MESSAGE+chr$(13)+chr$(10)+XLINE
Endif

If I >= LISTMAX : Break : Endif

Until fstat <> 0

# close the file
Openi Using [ZZZ]

End

Thanks

Chris 

  • 0

    Hi Chris, I don't understand your issue, can you please give a precise example?

  • 0 in reply to Bruno Gonzalez

    Hey Bruno, My issue is that the trace file is not being read correctly. It is concatenating all of the strings together. This was not an issue in v11 but is an issue with this new version for me. For example, my trace file would read like this: 

    #<AdxVL>@(#)%I% 06/09/2022 10:05:31 (ADMIN) EXECIML ZSDH
    ----------------------------------------------------------------------
    File Importing Sage\SAGEX3\folders\83197.txt
    ----------------------------------------------------------------------
    -------------------- Record No. 1 (Line Number 1)
    Creation of Delivery D-12167664

    1 records created

    Normal end of log file 06/09/2022 10:05:35

    When I try to read it useing rdseq, sage is reading it as 1 string so it would come back like this rather than it should be able to detect the new line...

    #<AdxVL>@(#)%I% 06/09/2022 10:05:31 (ADMIN) EXECIML ZSDH----------------------------------------------------------------------File ImportingSage\SAGEX3\folders\83197.txt------------------------------------------------------------------------------------------ Record No. 1 (Line Number 1)Creation of Delivery D-121676641 records createdNormal end of log file 06/09/2022 10:05:35

  • 0 in reply to ChrisCC

    I think something is wrong with your configuration as I tried right now on V12P29 and it works fine:

    I would advise to check your adxifs and adxirs variables to see how field and record separators are set.
    I don't believe this to be a bug, otherwise can you imagine all the rdseq in the product would do the same everywhere !

  • 0 in reply to Bruno Gonzalez

    How would you advise on what I can see is my adxifs or adxirs? I feel like something may have been setup incorrectly when we migrated over to V12. Is there like some system setting that may be resetting my adxirs value? Currently, I am setting my adxirs value to be chr$(13)+chr$(10)

  • 0 in reply to ChrisCC

    You're not supposed to set them, they are set automatically, notably depending if you're using Windows or Linux.
    Generally X3 is using LF (chr$(10)) as end of line character, but it can be CR+LF sometimes. Have you tried to read the content of a trace file directly without calling the importsil? It might be that the importsil is changing the adxirs value.
    FYI, if you need to modify adxirs or adxifs, use IOMODE instruction to only modify it for the file you are working with and not the whole product.

  • +1 in reply to Bruno Gonzalez
    verified answer

    Chris, we just started encountering this same issue, where it reads the entire trace file as one text glob, and doesn't recognize the line feeds.  It is happening on some versions of V12 and not others, so we are thinking of patch level affecting it.  We ended up inserting this line of code before the first openi statement, where you open the trace file.  This has resolved the issue for us, but we are still trying to determine why it only does this one some X3 instances and not others. 

    adxirs = chr$(10)

  • 0 in reply to Denise Hartman

    That is super weird ! Would you have the X3 and runtime version you are both using ?

  • 0 in reply to Bruno Gonzalez

    We encountered this issue on Release 2022 R1 (12.0.29), Version 90.29.58, Runtime 94.1.15

    It really had us stumped, because we have been using RDSEQ to read lot files for quite awhile.

  • 0 in reply to Denise Hartman

    Denise, Thank you! I knew I wasnt going crazy! Do you mean like this? I tried doing this, but its still not reading for me. 


    Subprog EXECIML(IMPTEMP, FNAME, MESSAGE)

    Value Char IMPTEMP
    Value Char FNAME

    Variable Char MESSAGE

    # Start the trace
    Call OUVRE_TRACE ("EXECIML "-IMPTEMP) From LECFIC

    Call IMPORTSIL(IMPTEMP, FNAME) From GIMPOBJ

    # end/write the trace
    Call FERME_TRACE From LECFIC

    adxirs = chr$(10)

    # open the trace file to get the details
    Openi filpath("TRA",GTRACE,"tra",0) Using [ZZZ]

    Local Integer I : I = 0
    Local Integer LISTMAX : LISTMAX = 100

    Local Char XLINE(250)

    Rdseq XLINE Using [ZZZ]
    Call MESSAGE(XLINE) From GESECRAN
    #Infbox num$(left$(XLINE,20))
    If left$(XLINE,20)="Creation of Delivery"
    MESSAGE = mid$(XLINE,22,99)
    Endif
    #Infbox MESSAGE

    # close the file
    Openi Using [ZZZ]

    End

  • +1 in reply to ChrisCC
    verified answer

    Here is my code.  I'm capturing any lines that begin with "<0001" as errors.  Prior to adding the line with the 20220609.ln comment, it was just reading the whole log file in a single text string.  Once I added that adxirs line, it works fine.  

    # Start the trace
    Call OUVRE_TRACE ("EXECIML "-IMPTEMP) From LECFIC

    Call IMPORTSIL(IMPTEMP, FNAME) From GIMPOBJ

    # end/write the trace
    Call FERME_TRACE From LECFIC

    adxirs = chr$(10) # 018 20220609.ln

    # open the trace file to get the details
    Openi filpath("TRA",GTRACE,"tra",0) Using [ZZZ]

    Local Char XLINE(100)
    # read the file
    Repeat
    Rdseq XLINE Using [ZZZ]
    If left$(XLINE,5)="<0001"
    # Write the error
    [F:YEVDE2]SBMNUM = SBMNUM
    [F:YEVDE2]ERRMSG = right$(XLINE,6)
    Write [F:YEVDE2]
    Elsif left$(XLINE,20)="Creation of Delivery"
    VCRNUM = right$(XLINE,22)
    Endif
    Until fstat <> 0

    # close the file
    Openi Using [ZZZ]

  • 0 in reply to Denise Hartman

    THANK YOU!!!! IT IS WORKING NOW!

  • +1 in reply to ChrisCC

    Great news!  This just came up for us a week or two ago, and as you can see in my notes, I just fixed this one earlier today.

  • 0 in reply to Bruno Gonzalez

    I am currently on 12.0.29, Version 90.29.58, runtime 94.1.15

  • 0 in reply to Bruno Gonzalez

    Hi Bruno. The online help for ADXIRS has example code of adxirs being explicitly set rather than using the IOMODE instruction. I agree that IOMODE is better as it is targeted to just the file stream in question. It would be helpful if that example could be updated to show it using the IOMODE methodology. 

  • 0 in reply to Denise Hartman

    I've tested on the exact same version and I don't have this issue.

  • 0 in reply to Bruno Gonzalez

    Hi  I came across the same issue on the V12P30. It seems something has changed on the default setting of "Rdseq" command. And thanks to  your solution worked for me as well.