Focal Point
(SOLVED)Changing Field Format - What am I missing?

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

March 13, 2009, 12:44 PM
jgelona
(SOLVED)Changing Field Format - What am I missing?
I'm trying to create a text file without trailing blanks and I want to dynamically change the format as describe in the following:

Changing Field Format

Here's my code:
DEFINE FILE XXXX
   PLINE/A100=PLNM || (',' | PFNM) || (',C/' | ACLID);
   PLEN/I3=ARGLEN(100,PLINE,'I3');
   FMT/A4='A' | EDIT(PLEN);
END
TABLEF FILE XXXX
PRINT PLINE/FMT
ON TABLE SAVE
END


I have confirmed that FMT contains values like A033, A040, etc. Is there some SET command needed for this? I've tried using TABLE as well and get the same error.
I'm getting the following error:
(FOC253) INVALID FORMAT SPECIFICATION ON LEFT HAND SIDE: FMT
(FOC009) INCOMPLETE REQUEST STATEMENT

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


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
March 13, 2009, 01:48 PM
Spence
see if this helps.

FILEDEF CARSAVE DISK C:\IBI\APPS\BASEAPP\carsave.ftm
DEFINE FILE CAR
PLINE/A100=COUNTRY || (',' | CAR) || (',C/' | MODEL);
PLEN/I3=ARGLEN(100,PLINE,'I3');
FMT/A4='A' | EDIT(PLEN,'999');
SLASH/A1 = '/';
NEW_FIELD/A110 = PLINE || SLASH || FMT;
END
TABLEF FILE CAR
PRINT NEW_FIELD
ON TABLE SAVE AS CARSAVE
END


WF 8 version 8.2.04. Windows.
In focus since 1990.
March 13, 2009, 02:09 PM
jgelona
Spence, thanks for the suggestion, but that won't do anything other than print PLINE with '/Axxx' on the end of the line. What I'm wanting to do is to print only the 1st 20 characters of PLINE if the last 80 are blank. For example, look at the following rows:
AAB,JESSIE,C/4151738
AAB,KAREN,C/2837056
AAB,MEAGAN,C/4151739
AAB,MIKE,C/2837057
AADAHL,ARVID L,C/545469
AADAHL,JANA L,C/545467
AADAHL,LAURA C,C/545468
AADAHL,ROGER N,C/545465
AAGESEN,DANNY,C/3762118
AAHPFOHMYYOH,MR AAHPFOHMYYOH,C/1623274

each of these lines are 100 characters in length. So on the 1st row, I want write out PLINE with a format of A20, the second line with A19, the third line with A20 and so on. According to the example in the article what I did should work unless I am missing something.

I could use the Linux sed command to truncate the line, but this file will have over 18 million rows and that still takes a while. I thought I could save some processing and I/O by having WF only write the significant characters of each row.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
March 13, 2009, 02:50 PM
Tom Flynn
FMT/A8='A' | EDIT(PLEN);

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
March 13, 2009, 03:36 PM
jgelona
I knew it was something easy that I missed. So it has to be an A8 field. Now the problem is that it still writes the full 100 characters to the file. I guess I'll open a problem report.
Thanks.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
March 15, 2009, 07:56 AM
GamP
And why exactly is that a problem? You can use the dynamic format for displaying information in a different format in your report. This can be teh Axx format or the Dxx or the Ixx format, used for the same column but in different situations. When you display this that's ok, but if you wish to hold this then what format should be recorded in the master file?
So, if you use dynamic formatting, this wil (can) not be held in an intermediate file.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
March 16, 2009, 09:56 AM
jgelona
I guess I was making this too hard. Using:

ON TABLE SAVE AS xxxx FORMAT TABT


does what I need.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.