February 01, 2007, 01:17 AM
manashFocus
In a input file i have 2 fields as such
roll no. status
01 y
01
01 N
02 N
02 N
03
03
03
04 Y
04 Y
04 N
Now in the output file i need to print roll no and status only once for each roll no and the status should be 'Y' if any one of the particular roll no. has 'Y' else it should print 'N'
Ex - The ouput should be
roll no. status
01 Y
02 N
03 N
04 Y
as roll no. 1 has atleast one status as 'Y" so its output status should be 'Y'
roll no 2 has no status as 'Y' so its output status should be 'N'
Similarly as roll no. 3 has no status as 'Y' so its output should be 'N'
and as roll no. 4 has atleast one status as 'Y' so its output status should be 'Y'
So can u sugest some solution
FOCUS 7.1.1/ MF(OS/390)
February 01, 2007, 08:43 AM
Francis MarianiIt's hard to focus when the topic title is "Focus".
Why not use a more descriptive title?
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
February 01, 2007, 09:32 AM
Francis MarianiYou file has to be pre-sorted by Roll No.
Then you can code something like this:
FILEDEF TEMP2 DISK C:\IBI\APPS\TEMP\TEMP2.FTM
DEFINE FILE TEMP2
FINAL_STATUS/A1 =
IF STATUS EQ 'Y' THEN 'Y' ELSE
IF ROLL_NO EQ LAST ROLL_NO AND STATUS IN (' ','N') AND FINAL_STATUS NE 'Y' THEN 'N' ELSE
IF ROLL_NO NE LAST ROLL_NO AND STATUS IN (' ','N') THEN 'N' ELSE FINAL_STATUS ;
END
TABLE FILE TEMP2
SUM
FINAL_STATUS
BY ROLL_NO
END
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
February 01, 2007, 09:46 AM
Dan KennyWasn't this question posted in an earlier thread?
focus manash, posting the same question multiple times isn't going to get you more answers, it's just going to frustrate those that are trying to help.
-- Dan
P.S. You need a subject more descriptive than "Focus", too. Like "Focus condensing output".
Dan Kenny
University of Nebraska at Omaha
Prod: WF 7.1.6 Linux -- Test: WF 7.6.0 Linux
February 01, 2007, 10:54 AM
KerryHi manash,
Can you please try the following code:
FILEDEF MYFILE DISK C:\IBI\APPS\DIALOGUE_MANAGER\MYFILE.TXT
-RUN
TABLE FILE MYFILE
PRINT
STATUS
COMPUTE
NEWSTAT1/I1=IF LAST ROLLNUM NE ROLLNUM THEN 1 ELSE 0;
GOODSTAT/A1=IF NEWSTAT1 EQ 1 AND STATUS EQ 'Y' THEN 'Y' ELSE 'N';
WHERE TOTAL NEWSTAT1 EQ 1
BY ROLLNUM
END
The data:
myfile.txt
01 Y
01
01 N
02 N
02 N
03
03
03
04 Y
04 Y
04 N
Hope this helps.
Cheers,
Kerry
Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
February 01, 2007, 01:49 PM
iraxx/a1 =
if ((rollno eq last rollno) and (last status
eq 'y') then 'y' else
if ((rollno eq last rollno) and (status
eq 'y')) then 'y' else
if (rollno eq last rollno) then 'n';
you can make this more nested, but i elongated to make it more legible. Hope it helps...
aix-533,websphere 5.1.1,apache-2.0,
wf 538(d), 537 (p),
==============
7.6.11 (t) aix 5312
websphere 6.1.19
apache 2.0