M@SYSNUM System Variable Failure

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
jyoung
Posts: 690
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

M@SYSNUM System Variable Failure

Post by jyoung » Fri Jan 19, 2018 9:34 am

Having a problem getting a System Variable working on the iSeries. It works fine on my local windows box.

I have a System Variable autonumber defined as such:
autonum.PNG
autonum.PNG (7.02 KiB) Viewed 4802 times
And I am using it like this

Code: Select all

#SYS_APPLN.TraceMessageData( "Generating Employee Id" )
#EmployeeId := *AUTONUM08PTOEMPLOY
#SYS_APPLN.TraceMessageData( "Inserting Employee with Id: &1" #EmployeeId )
insert fields(#EmployeeInsertFields) to_file(PTOEmployee) io_error(*NEXT)
#SYS_APPLN.TraceMessageData( "Employee &1 Inserted. Status: &2" #EmployeeId #IO$STS )
if_status is_not(*OKAY)
return
endif
When running on Windows this works fine, but when running on the iSeries, execution seems to stop at the #EmployeeId := *AUTONUM08PTOEMPLOY line and no error log is created.

Tracing the output shows the last thing it did was try to use the System Variable
output.PNG
output.PNG (11.19 KiB) Viewed 4802 times
Looking at the Master x_err.log shows nothing
master-log.PNG
master-log.PNG (25.68 KiB) Viewed 4802 times
I've confirmed the system variable IS on the iSeries.

Am I missing something to make them work? I have used them before and don't recall having a problem like this.

jyoung
Posts: 690
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: M@SYSNUM System Variable Failure

Post by jyoung » Tue Jan 23, 2018 8:50 am

With the help from support, got this figured out.

What has happening was a name collision between the M@SYSNUM program and a physical file.

The M@SYSNUM uses part of the SystemVariable name to determine what data area to use so my System Variable is
*AUTONUM08PTOEMPLOY

And my File Identifier is
PTOEMPLOY

This was causing the failure, and it appears like the M@SYSNUM program does not issue any error if something goes wrong (such as a name collision).

VL LANSA also does not issue a warning at design time that you have a possible conflict.

So, long story short, make sure your AutoNumber names don't collide with your File Identifiers.

Speedlime
Posts: 3
Joined: Wed Feb 03, 2021 2:52 am

Re: M@SYSNUM System Variable Failure

Post by Speedlime » Wed Apr 21, 2021 12:27 am

Just to add to this, might not be clear in the wonderful documentation when you go looking for it.

1) The data area only get created on the iSeries when you use the variable for the first time, do not go looking for it once you checked in the variable.

2) When the *autonum07XXXXXX gets to the max number ( ie if it was configured to 7.0 and hits 9999999) it will reset back to 1.

3) As stated above make sure the name after the nn (number) is unique.

Post Reply