Focal Point
[SOLVED] Truncation Using a Define Field

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

April 09, 2010, 07:28 AM
ktnj
[SOLVED] Truncation Using a Define Field
Hello All,

We need to truncate a 200 character field to 100 characters using a define statement.

field100/A100 = Edit(field200);
didn't work.

Can you tell me what would?
The truncated positions could contain any characters, not just spaces or zeros.

Thanks to all!

FOCUS 7.2.5
IBM mainframe Z/OS

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


April 09, 2010, 07:48 AM
Dan Satchell
Function SUBSTR should work.

FIELD100/A100 = SUBSTR(200,FIELD200,1,100,100,'A100');



WebFOCUS 7.7.05
April 09, 2010, 08:14 AM
ktnj
[SOLVED] THANKS


April 11, 2010, 05:25 PM
Waz
Please make yourself familiar with the functionsa available in FOCUS, they are all in the technical documentations.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

April 12, 2010, 01:05 PM
Darin Lee
Although you can use EDIT to put a smaller field into a larger one, you cannot put a larger field into a smaller one without using a mask. Dan's use of SUBSTR is probably the shortest way to get what you want. You could also use EDIT in the following manner to get the first 100 characters of the field (there are 100 9's)

field100/A100 = EDIT(field200,'9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999');

The trailing $ signs are not necessary if you're just excluding al remaining characters. Refer to the documentation for proper use of the EDIT command.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat