Focal Point
READ fixed length var

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

November 13, 2007, 06:54 PM
MacLonghorn
READ fixed length var
I'm trying to read 2 variables from a SQL stored procedure output:

TABLE FILE SQLOUT
PRINT id message
ON TABLE SAVE AS MYSQL
END
-RUN
-READ MYSQL &initid.I11. &message.A120.

the first variable is fine, but the second (&message) being saved as A100V. This is a problem as vars defined this way actually concatenate all columns, so instead of &message being "Insert failed", I get "000037Insert failed". I've read about the -READ command, but I'm still a little unsure how to use it in this case.


Thanks.

Mark
WF 7.6 Windows
November 13, 2007, 10:15 PM
Tom Flynn
quote:

TABLE FILE SQLOUT
PRINT id message
ON TABLE SAVE AS MYSQL
END
-RUN
-READ MYSQL &initid.I11. &message.A120.



  
DEFINE FILE SQLOUT
  MSG/A120=MESSAGE;
END

TABLE FILE SQLOUT
PRINT id MSG
ON TABLE SAVE AS MYSQL
END
-RUN
-READ MYSQL &initid.I11. &MSG.A120.


OR

-READ MYSQL &initid.I11. &FILL.A6. &message.A120.

Whatever you think is best....


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
November 14, 2007, 08:50 AM
PBrightwell
Mac,

When using var char the first 6 characters are the actual length of the field. The reading that as a separate variable as Tom suggested should work.


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
November 14, 2007, 09:48 AM
Tony A
You can also issue SQL SQLMSS SET VARCHAR OFF.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10