Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GENTRAN EXTENDED RULES

Status
Not open for further replies.

cube12345

Programmer
Oct 17, 2002
2
0
0
GB
Hi.

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.

Thanks in advance.
 
cube12345,

Give me a general idea of what you want to do & I can give you some examples.
 
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.
 
Use the strstr function within a loop.

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))).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top