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

Sort to insert record in an empty file.


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

Active User


Joined: 20 Apr 2022
Posts: 150
Location: India

PostPosted: Thu Jan 23, 2025 11:09 pm
Reply with quote

Hi all,

I have a PS file let say ALT.PS.FILE1 having LRCL 80 RCFM FB and it is actually an empty file which contains 70 empty lines. I want to copy a data from another ps file ALT.PS.FILE2 to ALT.PS.FILE1. My ALT.PS.FILE2 has some records not sure how many it could be but for sure not more than 70 record. I want to copy data in my empty file which is ALT.PS.FILE1 from ALT.PS.FILE2 in such a way that it copies the record from ALT.PS.FILE2 file and rest of the line should remain blank. for example my ALT.PS.FILE2 has 6 records it should copy 6 records in my empty file from starting position and rest all other 70-6=64 records should be blank record. i hope I am able to explain my requirement here. How this empty file could be edited in this way. I tried many things but no luck till this time. Any help of link to any solution where i can go an read it would be helpful here.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2173
Location: USA

PostPosted: Thu Jan 23, 2025 11:27 pm
Reply with quote

What does this mean?
Quote:
an empty file which contains 70 empty lines.


Any real example, please, when the used terminology is not clear.

Quote:
I tried many things but no luck till this time.

Please, present here AT LEAST ONE of the many things you've tried, including the used code, and all input/output/log data.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1371
Location: Bamberg, Germany

PostPosted: Fri Jan 24, 2025 11:30 am
Reply with quote

Code:
//WHATEVER EXEC PGM=ICEMAN             
//F1       DD *                       
                                       
                                       
                                       
                                       
                                       
                                       
                                       
                                       
                                       
                                       
/*                                     
//F2       DD *                       
4711                                   
0815                                   
/*                                     
//SYSOUT   DD SYSOUT=*                 
//SORTOUT  DD SYSOUT=*                 
//SYSIN    DD *                       
  OPTION COPY                         
  JOINKEYS F1=F1,FIELDS=(81,8,A),SORTED
  JOINKEYS F2=F2,FIELDS=(81,8,A),SORTED
  JOIN UNPAIRED,F1                     
  REFORMAT FIELDS=(F2:1,80)           
  END                                 
/*                                     
//JNF1CNTL DD *                       
  INREC OVERLAY=(81:SEQNUM,8,ZD)       
  END                                 
/*                                     
//JNF2CNTL DD *                       
  INREC OVERLAY=(81:SEQNUM,8,ZD)       
  END                                 
/*
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 150
Location: India

PostPosted: Fri Jan 24, 2025 11:42 am
Reply with quote

Hi Apologies, i tried my best to explain the situation. let me try again.

I have existing file which is empty and look like below having 43 records max.

Code:
ssssssssssssssssssssssssssssssssssssssssssssssssss
 VIEW       ALT0.DB2BIND.INPUT.TRIGGER2           
 Command ===>                                     
 ****** ***************************** Top of Data *
 000001                                           
 000002                                           
 000003                                           
 000004                                           
 000005                                           
 000006                                           
 000007                                           
 000008                                           
 000009                                           
 000010                                           
 000011                                           
 000012                                           
 000013                                           
 000014                                           
 000015                                           
 000016                     


like that 000043 max record in above file.

I want to copy the record from another file to this existing file in such a way that copy of the record should start from 00001 postion and rest records should be kept as it is : for example
my input file has 3 record then my existing file should look like below.

Code:
 [quote]EDIT       ALT0.DB2BIND.INPUT.TRIGGER2                     Colu
 Command ===>                                                  S
 ****** ***************************** Top of Data **************
 000001 rec1data                                               
 000002 rec2data                                               
 000003 rec3data=REST BELOW LINE SHOULD BE EMPTY AS IT IS  till 43rd record.   
 000004                                                         
 000005                                                         
 000006                                                         
 000007                                                         
 000008                                                         
 000009                                                         
 000010                                                         
 000011                                                         
 000012                                                         
 000013 
[/quote]

I am not sure with using sort we can edit the existing file in this way or not .i tried concatenating but that is not giving me desired result.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1371
Location: Bamberg, Germany

PostPosted: Fri Jan 24, 2025 11:46 am
Reply with quote

See my sample.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2173
Location: USA

PostPosted: Fri Jan 24, 2025 7:26 pm
Reply with quote

Digvijay Singh wrote:
I am not sure with using sort we can edit the existing file in this way or not .i tried concatenating but that is not giving me desired result.

SORT allows usage of an input dataset (but not input file, which is actually a DD statement!) also as output dataset, because the output is written from its temporary storage, at the end of processing. Actually the output dataset is not updated, but overrode.

FYI:
"Empty file" = a dataset with ZERO RECORDS inside of it.
"Empty record" = a record with ZERO bytes inside of it.
"Empty line" - sometimes is used instead of "blank line", but only when from the context it is clear that pure text data is being discussed.

P.S.
Joerg decided to guess by himself what did you mean in your post, but most of the people do not deign to such act of grace, when the used terminology is like Chinese without any samples.

P.P.S.
Remains unclear, what are "the many things you have tried"?
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 Create a specific record/file based o... SYNCSORT 8
No new posts using symbolics in the destination fi... All Other Mainframe Topics 12
No new posts Can BPXBATCH update TAPE file COBOL Programming 3
No new posts Partial Sort conditions for PD fields DFSORT/ICETOOL 16
No new posts 3 File Match Method - Useful across a... COBOL Programming 2
Search our Forums:

Back to Top