Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Problem with CTRAN function

Problem with CTRAN function

Problem with CTRAN function

Hi, i'm in trouble with the function CTRAN when the string I write in the parameter is a numeric value.

This is the code :

-SET &PDVTITOL =CTRAN(&TLUN , &VTITOLO , 032 , 095, 'A30');
-SET &DVTITOLO =CTRAN(&TLUN , &PDVTITOL , 039 , 095, 'A30');
If I put the value 'aa' in the field VTITOLO the results is aa. Instead, if I put any numeric value (like 33) the result is blank.

Help me please.

Many thenks

RE: Problem with CTRAN function

I have not been able to duplicate your results with WF7.6.9 but I did notice that the length to PDVTITOL is set to A30 but when the second CTRAN is run, the legth of &VTITOLO is used; it works but is not recommended.



RE: Problem with CTRAN function

Not being able to duplicate this is still vexing me. It may be that  FOCUS right-justifies the output from the first iteration of CTRAN when the first variable is set to integer 33. Then, in the second iteration of CTRAN, where the length is NOT set to 30, the function only examines the left part of the field.
There IS a difference between WF and FOCUS.

RE: Problem with CTRAN function

Hi HTH, thank you very much for your interest in my problem.. I think you have to know that i'm using an old focus version (6.40) and i think it could be a bug of this release.
I'm using CTRAN because i want to extract all records about a Film Title and many titles contain quotes or blank characters. So, with first ctran i change blank characters in '_' and the second ctran take the result of first one and change quotes always in '_'. I do the same thing with a define to change, in the same way, the content of the real field... Now, here in Italy there is 2012 and when i put in the variable field this 'name' the result is ' '; if i put any other character before the number the ctran make his works correctly. I don't understand why you say that in the second iteration the length is not set to 30. The lenght of field is not the last field in the string? Reading ctran help i've seen that it processes alphanumeric character not only alpha.... I don't understand sad
Sorry for my english..
Best regards

RE: Problem with CTRAN function

The last parm, A30, in the first interation of CTRAN tells FOCUS that the output field is an alphanumeric of length 30. I am concerned that your old release right-justifies (and blank-fills to the left) the numeric output in positions 29-30 when the variable is a two digit numeric like 12. According to my theory, CTRAN would place the result in positions 1-2 if the &var were AB, an alpha character string (left justified and blank-filled).
Then on the second interation, the instruction's first parm tells CTRAN to look at the first n characters (where n is &TLUN). But remember that the second &var is set to length 30.
I don't have mainframe FOCUS to test this so why don't you add
And change the second iteration of CTRAN to use &TLUN2.
HTH (Hope the helps)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close