Once a .mcmd command file is created, we compile it
using the "mbuild" command from the command prompt.
• For MOCA commands involving C we must also compile
the C source file into the VARint or USRint libraries.
• For MOCA commands involving Java we must compile
the Java source file into the LES.jar file.
• The mbuild command will compile the .mcmd command
file and put it into the commands.mem file on the
system.
• Once everything is compiled, the MOCA server will then
handle all the details concerning invoking the command.
Log in using telnet or SSH and change directory to the LES\data directory in the environment
Local Syntax – running and testing command.
• Ok, now I have a MOCA command ready, how do I RUN it???
• You can run MOCA commands and local syntax from Server
Command Operations in the WMS GUI.
• You can run MOCA commands and local syntax from the WinMSQL
tool.
• You can run MOCA commands from the MSQL command line
console.
Testing and Tracing
• Once our MOCA command is ready, we can test it using one of the
tools to execute MOCA commands.
• The MOCA architecture has a tracing feature where we can trace
the execution of commands to help with debugging.
• It is usually a good idea to test new MOCA command by running
them stand alone first before trying to integrate the command into
Reports, Screens, Processes, etc.
Trace Files continued…
• Trace files can also started, stopped, and viewed from the
WinMSQL tool.
• Trace files are one of the most important debugging tools we have.
• When we have production issues, sometimes we will ask the
customer to turn tracing on, reproduce the issue, and then send us
a trace file.
• With a trace file, sometimes we can debug an issue or determine its
cause even if we do not have access to the system.
Exercise
• We need a custom MOCA command to be run to generate a result set to
export to a file or spreadsheet.
• We need to have these fields in the result set for the file data:
• ordnum from the ord table.
• adrnam, adrlin1, adrlin2, adrlin3 from the adrmst table for the billing
address on the ord table.
• Another field called adrlin4, that consists of adrcty, adrstc, and adrpsz
seperated by commas.
• Hint – adrmst.adr_id maps to ord.bt_adr_id.
• wh_id and ordnum are the arguments this command should accept.
• If no data is found, we need to generate one result set row with
"NO_DATA" in all columns.
• Test the MOCA in Server Command operations or WinMSQL before
creating the command.
Possible Solution using a query
[select ord.ordnum,
adrmst.adrnam,
adrmst.adrln1,
adrmst.adrln2,
adrmst.adrln3,
adrmst.adrcty,
adrmst.adrstc,
adrmst.adrpsz
from ord, adrmst
where @+ord.wh_id
and @+ord.ordnum
and adrmst.adr_id = ord.bt_adr_id] catch ( -1403 )
|
Possible Solution using a query continued…
if ( @? = -1403 )
{
publish data where ordnum = 'NO_DATA'
and adrnam = 'NO_DATA'
and adrln1 = 'NO_DATA'
and adrln2 = 'NO_DATA'
and adrln3 = 'NO_DATA'
and adrln4 = 'NO_DATA'
}
else
{
publish data where ordnum = @ordnum
and adrnam = @adrnam
and adrln1 = @adrln1
and adrln2 = @adrln2
and adrln3 = @adrln3
and adrln4 = @adrcty || ' , ' || @adrstc || ' , ' || @adrpsz
}
Once our MOCA is tested, be need to create the MOCA
Local Syntax command.
• We can do this one of two ways.
• The first way is to login to the server using telnet or SSH and create
the .mcmd file in one of two locations:
> %LESDIR%/src/cmdsrc/varint
> %LESDIR%/src/cmdsrc/usrint
• Another method is to use Server Command Maintenance to
create the MOCA Local Syntax command.
• For this exercise, create the command with the name: list var order
address for export trainXX – where XX is the suffix of the RedPrairie
login ID you have been given.
Now that the MOCA command is created:
• Run mbuild to recompile the MOCA commands into
commands.mem
• Test the MOCA command with some different parameters to make
sure it works correctly.
Comments
Post a Comment