Combine two rows



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

Combine two rows

Postby MemoPerez » Sat Nov 19, 2022 1:43 am

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
MemoPerez
 
Posts: 7
Joined: Sat Nov 19, 2022 1:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: Combine two rows

Postby sergeyken » Wed Nov 23, 2022 11:34 pm

First of all, please demonstrate: how did you get the first example?
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: Combine two rows

Postby MemoPerez » Tue Oct 24, 2023 7:47 am

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.
MemoPerez
 
Posts: 7
Joined: Sat Nov 19, 2022 1:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: Combine two rows

Postby sergeyken » Tue Oct 24, 2023 5:21 pm

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!!!
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: Combine two rows

Postby MemoPerez » Tue Oct 24, 2023 9:10 pm

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 :)
MemoPerez
 
Posts: 7
Joined: Sat Nov 19, 2022 1:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: Combine two rows

Postby sergeyken » Tue Oct 24, 2023 9:45 pm

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".
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: Combine two rows

Postby MemoPerez » Tue Oct 24, 2023 10:07 pm

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.
MemoPerez
 
Posts: 7
Joined: Sat Nov 19, 2022 1:27 am
Has thanked: 0 time
Been thanked: 0 time


Return to CA-Easytrieve