Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count function

Status
Not open for further replies.

ehagan

Programmer
Aug 6, 2002
2
0
0
US
I am relatively new to WebFocus and am trying to write a report utilizing multiple joins from mainframe datasets through the EDA relational gateway. My synonyms are set up correctly and my initial join is performed fine. When I use the report painter to count a specified field by userid the function works intermittently.

Using the following code results in data being returned correctly:

TABLE FILE MAF203
COUNT *
BY USERID
HEADING
&quot;PAGE <TABPAGENO &quot;
WHERE ( ACTIVITYTYPE EQ '4' )
AND ( CHANGEDFIELD EQ '12' );
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SET ONLINE-FMT HTML
END


However, when I use the same code removing the * with a fieldname I receive an error.

TABLE FILE MAF203
COUNT ACCTNUM
BY USERID
HEADING
&quot;PAGE <TABPAGENO &quot;
WHERE ( ACTIVITYTYPE EQ '4' )
AND ( CHANGEDFIELD EQ '12' );
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SET ONLINE-FMT HTML
END


The error I receive is :
(FOC003) THE FIELDNAME IS NOT RECOGNIZED: CNT.USRUSERID
A word which is assumed to be the name of a data field does not appear on the list of names or aliases for the file. Check the spelling of the fieldname.
(FOC009) INCOMPLETE REQUEST STATEMENT
The request statement is terminated with an END, RUN, semicolon (;), or end-of-file before the request is complete.


Why would I receive an error using the same exact code except for one word, when counting every field works? I receive the same errors utilizing the SUM CNT.ACCTNUM BY USERID syntax as well.

Any help would be greatly appreciated.

Thanks!!

ehagan
 
I believe there may have been a problem counting the instances due to the type of the field, alphanumeric. So in order to rectify this, I wrote a define statement on the table and ran it as a sum(counter) by userid.

DEFINE FILE MAF203
INSCOUNTER/I5=1;
END

TABLE FILE MAF203
SUM
INSCOUNTER

BY
USERID
WHERE ( ACTIVITYTYPE EQ '4' )
AND ( CHANGEDFIELD EQ '12' );
ON TABLE NOTOTAL
END

This seems to have worked.

Thanks :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top