MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Write an easytrieve program on a file with occurances

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Max
Beginner


Joined: 09 Jul 2003
Posts: 5
Topics: 2

PostPosted: Mon Jul 14, 2003 12:51 am    Post subject: Write an easytrieve program on a file with occurances Reply with quote

Can someone help me write an easytrieve job to generate a report for all occurances for a field(eg NAFM-H-CUST-NBR ) in the file below.

The report Im trying to generate will contain:

NAFM-COACCT
NAFM-H-CUST-NBR

Please Note: NAFM-NO-OF-HOLDERS is a key field : if <=1 there is only one holder for the policy and hence one occurance of NAFM-H-CUST-NBR. If > 1, there is more than 1 holder and multiple occurences of NAFM-H-CUST-NBR.


FILE MLAHLDER
NAFM-HOLDER-REC 1 2736 A
NAFM-KEY 1 28 A HEADING(' ' 'KEY')
NAFM-COACCT 1 8 A HEADING('CO' 'ACCT')
NAFM-CO 1 1 A HEADING('CO' ' ')
NAFM-ACCT 2 7 A HEADING('ACCT' ' ')
NAFM-LVL 9 2 A HEADING('LVL' ' ')
NAFM-POLICY 11 18 A HEADING('POLICY' ' ')
NAFM-POLICY-DATA 29 10 A HEADING('PLCY' 'DATA')
NAFM-POLICY-TYPE 29 1 A HEADING('PLCY' 'TYPE')
NAFM-FILLER1 30 9 A HEADING(' ' ' ')
NAFM-HOLDER-AREA 39 291 A HEADING('HLDR' 'AREA')
NAFM-NO-OF-HOLDERS 39 2 P 0 HEADING('NO' 'HLDRS')
NAFM-HOLDER-TABLE 41 91 A, +
OCCURS (12) HEADING('HLDR' 'TBL')
NAFM-H-STATUS 41 2 A HEADING('HLDR' 'STATS')
NAFM-H-STATUS-DATE 43 5 P 0 HEADING('STS' 'DATE')
NAFM-H-CUST-NBR 48 15 A HEADING('CUST' 'NBR')
NAFM-H-TITLE 63 8 A HEADING('TITLE' ' ')
NAFM-H-GIVEN-NAME 71 20 A HEADING('GIVEN' 'NAME')
Back to top
View user's profile Send private message
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Mon Jul 14, 2003 9:15 pm    Post subject: Reply with quote

try something like this
=======
Code:

FILE MLAHLDER
NAFM-HOLDER-REC 1 2736 A
NAFM-KEY 1 28 A HEADING(' ' 'KEY')
NAFM-COACCT 1 8 A HEADING('CO' 'ACCT')
NAFM-CO 1 1 A HEADING('CO' ' ')
NAFM-ACCT 2 7 A HEADING('ACCT' ' ')
NAFM-LVL 9 2 A HEADING('LVL' ' ')
NAFM-POLICY 11 18 A HEADING('POLICY' ' ')
NAFM-POLICY-DATA 29 10 A HEADING('PLCY' 'DATA')
NAFM-POLICY-TYPE 29 1 A HEADING('PLCY' 'TYPE')
NAFM-FILLER1 30 9 A HEADING(' ' ' ')
NAFM-HOLDER-AREA 39 291 A HEADING('HLDR' 'AREA')
NAFM-NO-OF-HOLDERS 39 2 P 0 HEADING('NO' 'HLDRS')
NAFM-HOLDER-TABLE 41 91 A, +
OCCURS (12) HEADING('HLDR' 'TBL')
NAFM-H-STATUS 41 2 A HEADING('HLDR' 'STATS')
NAFM-H-STATUS-DATE 43 5 P 0 HEADING('STS' 'DATE')
NAFM-H-CUST-NBR 48 15 A HEADING('CUST' 'NBR')
NAFM-H-TITLE 63 8 A HEADING('TITLE' ' ')
NAFM-H-GIVEN-NAME 71 20 A HEADING('GIVEN' 'NAME'

ws-sub w  2 n

file report1 printer
ws-coacct         w    8 a    HEADING('CO' 'ACCT')
ws-custno        w    15 a    HEADING('CUST' 'NBR')

job input mlahlder

move NAFM-COACCT to ws-coacct
ws-sub = 1
do while  ws-sub le 12

 if NAFM-H-CUST-NBR(ws-sub) not spaces
    move NAFM-H-CUST-NBR(ws-sub) to ws-custno
    print report1
 end-if

report report1 printer
line 1 ws-coacct ws-custno   
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group