View previous topic :: View next topic |
Author |
Message |
naga Beginner
Joined: 03 Nov 2005 Posts: 3 Topics: 1 Location: INDIA
|
Posted: Thu Nov 03, 2005 2:12 am Post subject: How to check a field in the record ? |
|
|
A file contains number of records. We have to check everyfield,if the field contains data count the record, Otherwise should not count the record.
can u help me.. _________________ NAGA |
|
Back to top |
|
|
acevedo Beginner
Joined: 03 Dec 2002 Posts: 127 Topics: 0 Location: Europe
|
Posted: Thu Nov 03, 2005 2:17 am Post subject: |
|
|
How to check a field in the record ?
you should know the position and length of the field, if it's numeric (check for zero) or alphanumeric (check for spaces)....
I would recommend you to post an example...
( http://mvsforums.com/helpboards/viewtopic.php?p=24447#24447 ) |
|
Back to top |
|
|
acevedo Beginner
Joined: 03 Dec 2002 Posts: 127 Topics: 0 Location: Europe
|
Posted: Thu Nov 03, 2005 2:29 am Post subject: |
|
|
now that I've re-read your question... I thought it was posted in the Utilities forum... sorry.
what programming language are you using? |
|
Back to top |
|
|
naga Beginner
Joined: 03 Nov 2005 Posts: 3 Topics: 1 Location: INDIA
|
Posted: Thu Nov 03, 2005 2:44 am Post subject: |
|
|
hi,
thanks for your fast response.
I have some fields.
I want to check whether any data is present in those fields or not. if data is present we will increase the count,based on the count we have to calculate the percentage.
and the desired out put should like
COUNT STATISTICS
*---------------------------------------------------------*
TOTAL NUMBER OF RECORDS : 5,000
*-----------------------*
FIELD-NAME INCIDENCE COUNT INCIDENCE %
*--------* *-------------* *---------*
name 5000 100%
number 320 6% _________________ NAGA |
|
Back to top |
|
|
naga Beginner
Joined: 03 Nov 2005 Posts: 3 Topics: 1 Location: INDIA
|
Posted: Thu Nov 03, 2005 3:42 am Post subject: |
|
|
COBOL _________________ NAGA |
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Thu Nov 03, 2005 4:25 am Post subject: |
|
|
Naga,
Quote: |
A file contains number of records. We have to check everyfield,if the field contains data count the record, Otherwise should not count the record.
|
Your question is clear but not complete. You need to tell us the following.
1. how many fields you have in your file
2. what are their types (numeric / alpha...)
3. Is Zero considered as a empty condition for a Numeric field ?
4. What is the LRECL and RECFM of your file ?
5. What technology solution (COBOL / SORT / FILEAID / EASYTRIEVE) are you looking at ?
You have mentioned that your programming language is COBOL but are you trying to incorporate this COUNTER logic in COBOL ? or do you want some utilities to do this for you.
If you are using COBOL then you can simply follow the algorithm below.
Code: |
1. Read input file record by record.
2. For each record do the following.
2.1 If Field-1 NOT = SPACES AND NOT = ZEROES AND NOT = LOW-VALUES
2.1.1 Increment Field-1-Counter by one
2.2 If Field-2 NOT = SPACES AND NOT = ZEROES AND NOT = LOW-VALUES
2.2.1 Increment Field-2-Counter by one
......
3. Display Counter values.
|
Hope this helps,
Thanks,
Phantom |
|
Back to top |
|
|
|
|