IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Adding first / last acct numerber to an existing file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
late4tt

New User


Joined: 22 Oct 2023
Posts: 6
Location: US

PostPosted: Tue Oct 24, 2023 9:07 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2000
Location: USA

PostPosted: Tue Oct 24, 2023 9:31 pm
Reply with quote

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
View user's profile Send private message
late4tt

New User


Joined: 22 Oct 2023
Posts: 6
Location: US

PostPosted: Tue Oct 24, 2023 10:20 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2000
Location: USA

PostPosted: Tue Oct 24, 2023 11:30 pm
Reply with quote

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
View user's profile Send private message
late4tt

New User


Joined: 22 Oct 2023
Posts: 6
Location: US

PostPosted: Wed Oct 25, 2023 12:27 am
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2541
Location: Silicon Valley

PostPosted: Wed Oct 25, 2023 3:57 am
Reply with quote

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
View user's profile Send private message
late4tt

New User


Joined: 22 Oct 2023
Posts: 6
Location: US

PostPosted: Thu Oct 26, 2023 12:01 am
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2000
Location: USA

PostPosted: Thu Oct 26, 2023 12:32 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 7
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
Search our Forums:

Back to Top