LOGIC TO SUM THE SAMQ RECORD IN - Easytrieve



Unicenter CA-Easytrieve Plus Report Generator: CA's information retrieval and data management tool

LOGIC TO SUM THE SAMQ RECORD IN - Easytrieve

Postby aripalli » Wed Mar 21, 2012 12:21 am

Hi All,

I have Two files as input

FILE1
DATA1 1 8 A

FILE2
DATA2 1 8 A
QUANTITY 9 5 A
INDICATOR 14 1 A

FILE3
DATA3 1 8 A
QUANTITY3 9 5 A

IN FILE1 I HAVE RECORDS AS FOLLOW

ITEM1
ITEM2
ITEM3

IN FILE2 I HAVE RECORDS AS THERE IS NO LIMIT FOR OCCURENCES OF THE EACH RECORD I MEAN DUPLICATE IS ALLOWED.

ITEM1 10 P
ITEM1 5 P
ITEM1 2 P
ITEM2 10 P
ITEM3 1 P
ITEM3 2 P
ITEM3 1 U
ITEM3 6 P

BELOW IS REQUIREMENTS:

GET RECORD FROM FILE1
I.,E. ITEM1 READ AGAINST FILE2 AN ADD THE QUANTITY WHERE INDICATOR IS 'P' AGAINST ITEM1
AND WRITE TO SUM TO FILE3 QUANTITY

IF ONLY ONE RECORD IS MATCHING FROM FILE1 TO FILE2 WRITE THAT ALONE WITH QUANITY FROM FILE2

SIMILARY READ FILE1 GET ITEM3 AND SUM THE QUANITY AGAINST IND 'P' WRITE FILE3

IN FILE 3 THERE SHOULD BE ONLY ONE ENTRY PER RECORD.

I AM LOOKING FOR THE HELP TO WRITE CODE, WHAT WORK-VARIABLES NEEDS TO BE DEFINED AND HOW WE CAN SUM THESE QUANITY USING EAZYTRIEVE AND WRITE THE TOTAL SUM OF VALUES.

PLEASE HELP ME
aripalli
 
Posts: 5
Joined: Sun Jan 29, 2012 6:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: LOGIC TO SUM THE SAMQ RECORD IN - Easytrieve

Postby enrico-sorichetti » Wed Mar 21, 2012 12:48 am

posting in all CAPITALS is like shouting and is a symptom of bad manners
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2934
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 156 times

Re: LOGIC TO SUM THE SAMQ RECORD IN - Easytrieve

Postby dick scherrer » Wed Mar 21, 2012 1:31 am

Hello,

Suggest you post what the processing logic would be (use pseudo code, not "real" code). We can review this and if your approach is correct, then we can work on implementing in Easytrieve.

If you do not understand the logic needed, which language will not matter.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6269
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: LOGIC TO SUM THE SAMQ RECORD IN - Easytrieve

Postby aripalli » Wed Mar 21, 2012 9:15 am

sorry Enrico, i thought Caps makes easy readability
aripalli
 
Posts: 5
Joined: Sun Jan 29, 2012 6:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Logic To Sum The Same Record values in - Easytrieve

Postby aripalli » Wed Mar 21, 2012 9:21 am

Hi d.sch
Thanks for the reply,

REQUIREMENTS:

If ITEM1 (file1) = ITEM1 (file2) and INDICATOR = ‘P’

Then Sum the “Quantity” against the ITEM1 (from file2) and write as “Quantity3” (to file3) together with ITEM1

End-if

Need to perform the same comparison for each record of FILE1 with FILE2

I don't have idea how i can add up the Quantity fileds for the same record and writing.

Please Help me..
aripalli
 
Posts: 5
Joined: Sun Jan 29, 2012 6:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: LOGIC TO SUM THE SAMQ RECORD IN - Easytrieve

Postby BillyBoyo » Wed Mar 21, 2012 2:06 pm

OK, now look at Synchronised File Processing in the Easytrieve Plus Reference Guide. This will tell you how to write your JOB statement, how to identify change-of-key.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post