Page 1 of 1

Combine two rows

PostPosted: Sat Nov 19, 2022 1:43 am
by MemoPerez
Hello everyone, I'm extremely new at this, my knowledge in Easytrieve is close to 0. However, I'm trying to learn, and part of the assignment is to transform a report from this:


--------------------------------------------------------------------------
 OPER-NAME/                                                              
 OPER-ID   LOC   DB AUTH    TC   DUAL VERIFY   OP     DATE/TIME ADDED    
                           AUTH     LEVEL      TYP    DATE/TIME LAST MAINT
 -------------------------------------------------------------------------
 FUDD, ELMER                                                              
 A1B6374         01         02        N               09/23/2022 14:08:13
                                                      09/23/2022 14:08:13
 BUNNY, BUGS                                                              
 A1B8924         01         02        N               09/23/2022 14:09:00
                                                      09/23/2022 14:09:00
 TRUMP, DONALD                                                            
 A1B9847         01         02        N               05/11/2021 15:36:03
                                                      05/11/2021 15:36:03
 


to this:


---------------------------------------------------------------------------------------------------------------
 OPER-NAME      OPER-ID   LOC   DB AUTH    TC   DUAL VERIFY  OP      DATE/TIME ADDED      DATE/TIME LAST MAINT
                                          AUTH     LEVEL     TYP
 --------------------------------------------------------------------------------------------------------------
 FUDD, ELMER    A1B6374         01         02        N               09/23/2022 14:08:13  09/23/2022 14:08:13
 BUNNY, BUGS    A1B8924         01         02        N               09/23/2022 14:09:00  09/23/2022 14:09:00
 TRUMP, DONALD  A1B9847         01         02        N               05/11/2021 15:36:03  05/11/2021 15:36:03
 


My question here is, how can I 'combine' two rows into one using Easytrieve?

Thank you.

- Guillermo Pérez

Re: Combine two rows

PostPosted: Wed Nov 23, 2022 11:34 pm
by sergeyken
First of all, please demonstrate: how did you get the first example?

Re: Combine two rows

PostPosted: Tue Oct 24, 2023 7:47 am
by MemoPerez
sergeyken wrote:First of all, please demonstrate: how did you get the first example?

That's an output from another process. The task was to make it Excel-friendly (CSV file for example); as you can tell, it is hard to do filters and other data processes to that file as it is (mixed data in the same column).

As for the task itself, I know it's been a while but I thought I'd share my solution anyway. So I declared two files in the File Section (one for the input file and one for the output, both with different record lengths, input < output); for Working Storage I put only the header I print in the output.

Now, it is important to notice that each 'user' in the input report is split in 8 lines, so the main logic basically goes over each record, saves the data according to is position and puts it in the final report. To achieve this I created an array of size 8 that increments its value in each JOB sequence, when it reaches INDEX = 7 (array's max length) it resets to 0 and starts all over again.

In the end, the data saved for each user is then placed in one single record, being something like this:

INPUT:
REC1: ABRAHMS, MARY
REC2: AM186481 | |13 22 27|09 |N |12/05/2022 11:21:43|05/11/2021 15:36:03|APB APBF AXP |DXP FXP OPDP
REC3: |09/23/2022 14:08:13| |BXP BATB BATC |ORP BATI BATP
REC4: |BATD BATF BATV BATR BATS BXD
and so on until REC8.

OUTPUT:
REC1: ABRAHMS, MARY |AM186481| |13 22 27|09|N| |07/26/2023 11:00:57|07/26/2023 11:16:12| |APB APBF AXP BXP BATB BATC BATD BATF BATV BXA BXB BXC BKSC BKSD BKSI BKSM CAA4 CAA5 CAAE CAAX CAC2 |DXP FXP OPDP ORP BATI BATP BATR BATS BXD BXI
and so on, 1 rec only.

Re: Combine two rows

PostPosted: Tue Oct 24, 2023 5:21 pm
by sergeyken
Does this mean, every single record has a prefix "REC n:" in its first positions?

Please, be as clear as possible, and provide more detailed examples.

Do not forget to use the Code button for EVERY YOUR EXAMPLE!!!

Re: Combine two rows

PostPosted: Tue Oct 24, 2023 9:10 pm
by MemoPerez
Oh no, the RECn is to exemplify how the input and desired output look like.
I'm sorry, I can't share any of my coding for security reasons.
In the end it was a rather easy fix :)

Re: Combine two rows

PostPosted: Tue Oct 24, 2023 9:45 pm
by sergeyken
MemoPerez wrote:I'm sorry, I can't share any of my coding for security reasons.

This is a very popular stupidity.
What prevents you from changing every of your Number_Of_Nuclear_Bombs variable to, let's say, Total_Amount_of_Items???

You just need to understand THE METHOD OF PROCESSING; it has no relation to your, so called, "security requirements".

Re: Combine two rows

PostPosted: Tue Oct 24, 2023 10:07 pm
by MemoPerez
Then you shouldn't have any issues understanding the solution I provided in my second post :)

Now, if you feel like lending a hand in another subject, please refer to https://www.ibmmainframeforum.com/easytrieve/topic12956.html
I trust you'll find that question explained better.

Good day sir.