Im a Programmer working on Gentran NT ver3.1. Has anyone got any examples of conplex extended rule statements, or has anyone got any websites with any on.
I am running Gentran server version 3.01 on NT. I have created an export orders map version D93A.
From within the PIA segment data element #7008, which is a string, I want to replace a character which may be contained several times within the data element with another character.
I was wondering if you have an extended rule using a string variable to achieve this?
try using the string functions available for the extended rules they are powerfull enough to use to do this. write a looping program to parse the element and use string functions to cut or replace characters. night be a long funciton but it should work.
strstr returns the location within the argument string for the character specified.
To look for the letter "w" in a string, you would do this...
integr i;
i=strstr(#var1,"w"
Unfortunately, the extended rules in GENTRAN don't work quite like the [apparently similar] BASIC language. You will have to loop thru using the strstr until your variable ('i' in this example) returns a zero (no more occurrances exist).
With each iteraction that returns a non-zero value you will need to then create the new value by taking the LEFT portion of the subject string (left(x,(i-1)) and concatenating the replacement character and then concatenating the right portion of that same subject string (right(x,(len(x)-i))).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.