Saturday, April 23, 2011

Ever wondered why EDIFACT output has a "," as a decimal by default?

The ISO representation for decimal mark is the comma ( , ) but point on the line ( . ) is allowed as per ISO 31/0-1981.
In GXS AI, we can change this value in the Trade Guide. At the UNA level (Highest level of hierarchy in EDIFACT in TG), go to Outbound tab and you will find an option to change Decimal Notation.

Labels:

Saturday, April 12, 2008

XML file with empty tags fail with a post delimiter error

When an xml file is run through an XML map without using otxmlcanon pre-processor, the map fails if the xml file has empty tags, so it is very important to use the XML pre-processor.

Labels:

Tuesday, November 13, 2007

FILE_STAT function has some useful information about files

VAR->OTType which is usually a "file"
VAR->OTInputFileSize: which has the file size

Friday, November 02, 2007

Error when the square brackets are missed at the start of an element or a group

When the square brackets are missing or commented out at the start of an element or a group as shown below, one gets an error
'Access obj "VAR" for dm "DUMMYGROUP" not found'

;[]
VAR->OTTargetSuccessful = "Yes"
PERFORM("OTTrgEnd")

}*0 .. 1 ;; |-- end DUMMYGROUP --|

Friday, September 07, 2007

Tips for Searching Trace Logs

Application data: Start at the bottom.  Search up for "|  DM:"
Outbound EDI: Search down from the top for "errcode (number)"
Inbound EDI: Start at the top.  Search down for "Error# "

Other trace log items to look for:
Map Component filename or data model name
"ARRAY VAL"
"get_source"
"put_target"
"VALUE STACK" or "vstk"
Last error at the bottom of the trace log.

Wednesday, September 05, 2007

Look for VAR->OTTmpErr or OTCodeErr in the trace to find out if there are any errors

Look for VAR->OTTmpErr or ARRAY->OTCodeErr  in the trace log to find out if there are any errors during the translations when the get_source and put_target doesn't find the maps that should be called and doesn't produce the output.
For example when the trading partner doesn't exist in the Trade Partner Database, one would get a 303 error in variable VAR->OTTmpErr.

Friday, January 26, 2007

The environment variable GC_LOCALEDIR is important for AI3.2 control server to run

The environment variable GC_LOCALEDIR is important for AI3.2 control server to run.  If this environment variable is missing, then AI3.2 will not start.

Tuesday, September 19, 2006

AI Error - 184

One might get a 184 Error when PERFORM("OTTrgInit", "", "") is not put in a flat file translation on the target. 

Wednesday, June 28, 2006

Debugging the problem with EXECR function or others resulting in system signal errors

You can try running a "strace" on the translation on each differing system.

Strace is a system call trace, i.e. a debugging tool which prints out a trace of all the system calls made by a another process/program. The program to be traced need not be recompiled for this, so you can use it on binaries for which you don't have source. System calls and signals are events that happen at the user/kernel interface. A close examination of this boundary is very useful for bug isolation, sanity checking and attempting to capture race conditions.

In the simplest case strace runs the specified command until it exits. It intercepts and records the system calls which are called by a process and the signals which are received by a process. … System administrators, diagnosticians and trouble-shooters will find it invaluable for solving problems with programs for which the source is not readily available since they do not need to be recompiled in order to trace them. Students, hackers and the overly-curious will find that a great deal can be learned about a system and its system calls by tracing even ordinary programs. And programmers will find that since system calls and signals are events that happen at the user/kernel interface, a close examination of this boundary is very useful for bug isolation, sanity checking and attempting to capture race conditions. [http://www.die.net/doc/linux/man/man1/strace.1.html]

To Run:
Put your inittrans statement in a translation.sh script (and put a "sleep 20" as the very first line)
Execute à ./translation.sh &
This will toss the translation into the background and pop out a PID to STDOUT for the backgrounded process
Before your sleep time set ends, type and Execute à strace –T –f –p PID# > /tmp/translation.log
This will generate a strace output showing what happens system call wise with the translation. You can then look for the 126 return on PROD and the 0 return on PREPROD in the log and try to figure out what is causing the error.

Tuesday, April 11, 2006

TAI Segment on 997

AI generates a TA1 on the outbound 997 when your trading partner sends
a 1 in ISA14. Have your partners send a 0 in the ISA14 and AI will not
generate a TA1 segment on the outbound 997.

Or you could go into TradeGuide at the GS level of the partner and
Select "None" for the Functional Ack Level. This will turn the 997 off
for that partner.

Time Conversion Tip

Requirements:
While working on a global implementation (Application Integrator
centrally located on a US machine) we had requirements to convert AI
generated date/time to local date/time. There were 3 different
components of the requirements:
i) Date/time conversion in the data segments.
ii) Date/time conversion in the envelopes of
X12/EDIFACT standards & 997/CONTROL messages.
iii) Many countries we were trying to implement also
had daylight saving system. Date/time conversion was required to take
this into account too.

Solution:
In order to fulfill above mentioned requirements we did following:
i) Defined a function in User.inc to calculate the
time zone (and if daylight saving on or not) of the machine running
AI. Although Trade Guide have a configuration to store the time zone,
it doesn't have any daylight saving aware settings (at least I don't
know about it).So we relied on EXECR and a small Unix script to know
the time-zone/daylight of the machine running AI.
ii) In the trade guide profile we created a custom
tab under partner profile which hold following values:
1. Country time zone. List of countries supported with time conversion.
2. If time/date conversion is required in enveloping model and
Acks. Yes/No.
iii) We defined another function in User.inc to
calculate local date/time. In this function date/time difference
between US time (say CST) and the regional time (say Australia). This
required us to hard code some values (like time difference and
daylight saving dates)
iv) For all data maps where local date/time is
required we asked our regional mapping teams to use this function
(defined in step iii) to convert AI generated date/time to local
date/time.
v) For enveloping/Ack models we copied
OT*Evp.mdl/OT*Ack.mdl into SCJ*Evp.mdl/SCJ*Ack.mdl and added the time
conversion function in there. Time conversion function in these models
is called only when the TP profile had "time/date conversion on
enveloping" set to yes.

Friday, April 07, 2006

ANSI ASC X12 Standards Info

http://www.x12.org/x12org/index.cfm

Friday, February 03, 2006

De-referencing ARRAYS with no values on target .... A complete loop could be skipped in the output

Sometimes if ARRAYS are being de-referenced on the target and if the last ARRAY doesn't have a value, then that loop might not appear in the output.  To avoid the problem, always have another condition which will always work or another assignment where there is always a value.

Output file is not created in the appl directory if X12MsgInTestName has a path like b/TESTMAP

Output file is not created in the appl directory for Inbound translations if X12MsgInTestName (network filename in the inbound tab) has a path like b/TESTMAP.  Just TESTMAP is good enough because the sysappl path is automatically attached.
You will typically get error messages like these:

1      Executing: Copy from b/TESTMAP.SessionNo, to :appl\b/TESTMAP.SessionNo
163   EXEC Error On: otpack.exe b/TESTMAP.SessionNo archive\_b/TESTMAP.SessionNo

Don't rely on PRESENT(&SEGMENT) when using ABSENT rules for that segment

Don't rely on PRESENT(&SEGMENT) when using ABSENT rules. Even though you would think the segment is absent and PRESENT(&SEGMENT) would result in false, it will actually result in true because it executed the ABSENT rules. It may be a bug in the tool which I will report to GXS.

To extract the last x characters in a string or a number

Always use this principle to get the last x characters:

VAR->lastxcharacters = STRSUBS(VAR->lastxcharacters,x-1,STRLEN(VAR->lastxcharacters))

AI trying to read the source file again when trying to connect to the 2nd target.

AI tries to read the source file from where it left off when the 2nd target is called if the declaration in .att file is mentioned as S_MODEL and S_ACCESS instead of T_MODEL and T_ACCESS.

Various combinations of Numeric and Date formatting

Run
inittrans -at OTFmt.att -cs $OT_QUEUEID -tl 0 -I (on Unix)
otrun -at OTFmt.att -cs $OT_QUEUEID -tl 0 -I (On windows)

The output file "OTFmt.out" created in the home directory will have all the formats and respective outputs that one should expect for each kind of Date or Numeric formatting.

Map doesn't write all records if there is DM Item used outside its definition in Target

If a DM Item is used outside its definition in the Target, the map will not produce the output correctly.  This usually happens when you copy an existing DM items rules definition and forget to change the DM item name.

Delimiters are not created for the enveloping segments for outbound EDI documents

The Delimiters are not created for the enveloping segments for outbound EDI documents when OTSrcInit is used instead of OTTrgInit on the Target model.

Missing Header and trailer segments in an outbound document

If an outbound map component file is directly called instead of calling it through the OTEnvlop or ESEnvlop, then the output X12 document will come out without the header and trailer segments.