View previous topic :: View next topic
|
Author |
Message |
late4tt
New User
Joined: 22 Oct 2023 Posts: 6 Location: US
|
|
|
|
MY REQUIREMENT IS TO SORT OFF ACCTNO FROM A REPORT THEN EXTRACT THE FIRST / LAST ACCOUNT NUMBER FROM THE SUBSET OF ACCOUNTS
AND THEN APPEND THE ACCT NUMBERS TO THE END OF AN EXISTING 200 BYTE FILE IN A SINGLE
SORT STEP(PROCESS) AS IT WILL NEED TO BE RUN ON A LARGE NUMBER OF FILES IN ONE JOB.
THE ACCOUNT NUMBER IS IN POSTITION 23 FOR 11 OF THE REPORT FILE, THIS SORT WILL PULL JUST THE ACCOUNT
NUMBERS FROM THE REPORT.
- SORT FIELDS=(23,11,ZD,A)
- INCLUDE COND=(23,11,ZD,EQ,NUM)
INPUT
----+----1----+----2----+----3----+----4----+----5----+----
### - NAME ### A MM/DD/CCYY REPORT NAME
RELATED RELATED RELATED RELATED RELATED REL
DP S ### XXXXXXX9511 X ## 31
DP S ### XXXXXXX9547 X ## 31
DP S ### XXXXXXX9574 X ## 31
DP S ### XXXXXXX9590 X ## 31
### - NAME ### A MM/DD/CCYY REPORT NAME
RELATED RELATED RELATED RELATED RELATED REL
DP S ### XXXXXXX9591 X ## ##
DP S ### XXXXXXX9652 X ## ##
DP S ### XXXXXXX9720 X ## ##
DP S ### XXXXXXX9873 X ## ##
REPORT TOTAL: 00000000000000
OUTPUT (APPENDED TO AN EXISTING FILE AT POSITION 201
....DATA FOR 200|XXXXXXX9511 XXXXXXX9873
|POSITION 201 - FIRST ACCT
| POSITION 212 - LAST ACCOUNT
THANK YOU IN ADVANCE |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
1. Learn how to use the Code button for your samples.
2. Stop using uppercase for regular text.
3. Please distinguish between "file position", and "record position".
4. In mainframe, "datasets" are used instead of "files". "File" is a sequence of bytes. "Dataset" is a sequence of records.
Please, be polite to your potential readers.
Otherwise >90% of readers would ignore your topics. |
|
Back to top |
|
|
late4tt
New User
Joined: 22 Oct 2023 Posts: 6 Location: US
|
|
|
|
Sorry, First post...Let me try this again.
My requirement is to:
1) Sort off records with account numbers(pos 23,11) from a report dataset(FB133)
2) Then extract the first / last acct number record(pos 23,11)
3) Then append them both to (pos 201,11 and 213,11) which is the end of an existing dataset (FB200) that has 1 record with 200 bytes of other data.
Code: |
INPUT
----+----1----+----2----+----3----+----4----+----5----+----
### - NAME ### A MM/DD/CCYY REPORT NAME
RELATED RELATED RELATED RELATED RELATED REL
DP S ### XXXXXXX9511 X ## 31
DP S ### XXXXXXX9547 X ## 31
DP S ### XXXXXXX9574 X ## 31
DP S ### XXXXXXX9590 X ## 31
### - NAME ### A MM/DD/CCYY REPORT NAME
RELATED RELATED RELATED RELATED RELATED REL
DP S ### XXXXXXX9591 X ## ##
DP S ### XXXXXXX9652 X ## ##
DP S ### XXXXXXX9720 X ## ##
DP S ### XXXXXXX9873 X ## ##
REPORT TOTAL: 00000000000000 |
The output dataset
Code: |
OUTPUT (Appended to an existing dataset at position 201
....DATA FOR 200|XXXXXXX9511 XXXXXXX9873
|Position 201 - First Account
| Position 213 - Last Account |
Thank you again in advance |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
late4tt wrote: |
My requirement is to:
1) Sort off records with account numbers(pos 23,11) from a report dataset(FB133)
2) Then extract the first / last acct number record(pos 23,11)
3) Then append them both to (pos 201,11 and 213,11) which is the end of an existing dataset (FB200) that has 1 record with 200 bytes of other data. |
1) What the term "SORT OFF" stands for? First to SORT, then to DROP OFF, or what?
2) If you really need the "first/last" account, there is no need in any sort. If you try to sort the records, you probably need to find the "min/max" account NUMBERS?
Which approach is the correct one?
3) The "end of existing dataset" is the position just after the last record of this dataset. Since there was only one record FB200, the "end of existing dataset" will definitely create record #2 in this dataset.
There is a full mess in your explanation.
4) Since you have "a huge number of report datasets" to be processed, then: where to place the "first/last" accounts taken from the reports other than the first one? What is "the end of output FB200 dataset" to append the huge number of "first/last" accounts to?
5) Try to solve your issue in steps, one by one:
- find out how to get the (huge number of?) "first/last" accounts from a (huge number of?) input datasets?
- find out, how to append the (huge amount of?) data produced by your first solution "to the end of existing output dataset"? |
|
Back to top |
|
|
late4tt
New User
Joined: 22 Oct 2023 Posts: 6 Location: US
|
|
|
|
sergeyken,
I started a new post to clarify my requirements...Just have to figure out how to delete this thread.
To your comments:
- My sort off comment was related to identifying only records with account numbers. (Thought a sort would be needed but maybe not)
- The acct numbers are in a sorted order, so min/max might work (didn't think of that)
- The output dataset that is being added is currently 200, but will be expanded to 225 prior to this process so there will room for the account numbers. (sorry for the confusion on that) |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
re: output dataset that is being added is currently 200
Your statement is ambiguous. Are you referring to the length of the records or the number of records? |
|
Back to top |
|
|
late4tt
New User
Joined: 22 Oct 2023 Posts: 6 Location: US
|
|
|
|
Pedro wrote: |
re: output dataset that is being added is currently 200
Your statement is ambiguous. Are you referring to the length of the records or the number of records? |
The output dataset would have an LRECL of FB225, currently the first 200 bytes of the dataset contain other data. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
late4tt wrote: |
Pedro wrote: |
re: output dataset that is being added is currently 200
Your statement is ambiguous. Are you referring to the length of the records or the number of records? |
The output dataset would have an LRECL of FB225, currently the first 200 bytes of the dataset contain other data. |
OMG...
Either you need to add a NEW RECORD at the end of existing dataset,
OR
you need to OVERRIDE DATA at position 201 of the existing record!!!!!
These are two absolutely different operations.
P.S.
People should not be allowed to perform a job where they have no basic knowleges about. |
|
Back to top |
|
|
|