Focal Point
[SOLVED] Alpha numeric to Varchar conversion

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/47510622

February 27, 2009, 03:22 AM
Gopal
[SOLVED] Alpha numeric to Varchar conversion
how to covert a field of A22 format into A160V without white spaces

This message has been edited. Last edited by: Kerry,


WebFOCUS 769, Windows XP platform and Output formats: HTML,excel, PDF
February 27, 2009, 03:58 AM
GamP
Just do an assigment: FA160V = FA22;
What exactly do you mean with 'no white space'?
That's just what a AxxV variable does, it removes the white space when it is stored in the database.
But this is valid only for relational databases, not for FOCUS db nor for hold format alpha or binary.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
February 27, 2009, 05:36 AM
j.gross
Focus and xfocus support "alpha variable" fields.

Focus format is based on uniform segment-instance length within all pages of a Segment; segment instances are keyed to page and offset.

Xfocus is designed to accommodate variable-length fields, and thus variable-length segment instances (so your 1-character value in an A40V can take up less room than a full 40-char value): Segment instances are keyed to page and row (rather than page and offset); the offset and length are stored in a table on the page (somewhat like IDMS's page structure).


- Jack Gross
WF through 8.1.05
February 27, 2009, 09:52 AM
Gopal
Actually i am trying to create a define field which concate 3 fields(in RDBMS) of format A6,A8,A8 and then assign to A160V format

Below is the code I used in my
VALPFX/A7V = TRIMV('B', PFX, 6, ' ', 1, 'A6V');
VALBAS/A9V = TRIMV('B', BAS, 8, ' ', 1, 'A8V');
VALSFX/A8V = TRIMV('B', SFX, 8, ' ', 1, 'A8V')

CONCAT04/A22V = VALPFX || VALBAS || VALSFX;
Part_No/A160V= CONCAT04

I am storing this output in FOCUS database and set index to Part_No since I need to join this output with another table field of format A160V.

I am getting an error (FOC1400) SQLCODE IS -904 (HEX: FFFFFC78)


WebFOCUS 769, Windows XP platform and Output formats: HTML,excel, PDF
February 27, 2009, 10:06 AM
Tom Flynn
Gopal,

When does 7+9+8 equal 22???
quote:
VALPFX/A7V = TRIMV('B', PFX, 6, ' ', 1, 'A6V');
VALBAS/A9V = TRIMV('B', BAS, 8, ' ', 1, 'A8V');
VALSFX/A8V = TRIMV('B', SFX, 8, ' ', 1, 'A8V');


S/B

 
VALPFX/A6V = TRIMV('B', PFX, 6, ' ', 1, 'A6V');
VALBAS/A8V = TRIMV('B', BAS, 8, ' ', 1, 'A8V');
VALSFX/A8V = TRIMV('B', SFX, 8, ' ', 1, 'A8V');
 



Programmer error...

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
February 27, 2009, 10:32 AM
FrankDutch
Joining a virtual A160V field to a real A160V field is not a very smart idea.
I would suggest to convert the real A160V field to the A24 field (without the 'V'.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

February 27, 2009, 10:35 AM
Gopal
Sorry it is Typo error, i have it as
VALPFX/A6V = TRIMV('B', PFX, 6, ' ', 1, 'A6V');
VALBAS/A8V = TRIMV('B', BAS, 8, ' ', 1, 'A8V');
VALSFX/A8V = TRIMV('B', SFX, 8, ' ', 1, 'A8V')

only


WebFOCUS 769, Windows XP platform and Output formats: HTML,excel, PDF
February 27, 2009, 10:47 AM
Tom Flynn
Gopal,

I am sure we don't have all the information.

Is missing the semi-colon on this line also a typo???
  
Part_No/A160V= CONCAT04


quote:

Joining a virtual A160V field to a real A160V field is not a very smart idea.

Frank, he states he's creating a FOCUS DB, so, it's not virtual...

You are probably trying to JOIN a FOCUS DB with a RDBMS table; I have always mentored to pull the RDBMS data, HOLD it, then do the JOINs.

Using a VARCHAR for a JOIN is "not" a good idea, I refuse to do it. Frank's second statement is the route to take, maybe A160 instead of A22...

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
February 28, 2009, 06:11 AM
Gopal
It worked!! I did a Join define field of A22 against hold file field of A22 format....

Many Many Thanks....... Tom & Frank


WebFOCUS 769, Windows XP platform and Output formats: HTML,excel, PDF