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

move a record from one line to other line


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Apr 25, 2014 2:55 pm
Reply with quote

Hi,

I have a file (LRECL=108,RECFM=FB) in which a record needs to moved from line 500 to line 5090. I thouht of using STARTREC and ENDREC but it needs multiple steps to achieve final results.

Code:

//SYSIN   DD *
 OPTION COPY
 OUTFIL ENDREC=500


Any suggestions please? Thanks.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Apr 25, 2014 3:01 pm
Reply with quote

Here is the sample data -

Before:
Code:

   Menu  Utilities  Compilers  Help                                             
                                                                               
 PR0D E    PRODM.LM0XX.J0OB.TERM.EMPL.D0114           Line 00000500 Col 001 080
  Command ===>                                                  Scroll ===> CSR 
201113X1T    ABCX1T3T502014-05-19 VDCKK10000015006200000272025JXK69  N         


After:
Code:

   Menu  Utilities  Compilers  Help                                             
                                                                               
 PR0D E    PRODM.LM0XX.J0OB.TERM.EMPL.D0114           Line 00005090 Col 001 080
  Command ===>                                                  Scroll ===> CSR 
201113X1T    ABCX1T3T502014-05-19 VDCKK10000015006200000272025JXK69  N         


Thanks.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Apr 25, 2014 3:23 pm
Reply with quote

Add a sequence number.

Define a GROUP which starts are your original location and ends at the desired location. PUSH the entire record to a temporary extension (limits maximum record-length that can be deal with).

In OUTFIL, OMIT= the original record, IFTHEN for the desired sequence number, use /, Slash Operator, to output PUSHed record and current record, in the correct order. Cut records down to original length (IFOUTLEN is a good way, since you will have an IFTHEN).
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Fri Apr 25, 2014 4:39 pm
Reply with quote

This is kind of radical, I suppose, but it should work
Code:
//A       EXEC PGM=IKJEFT01   
//SYSTSPRT DD  SYSOUT=*       
//SYSTSIN  DD  *               
E 'your-dataset' DATA NONUM
V                             
DOWN 5090                     
DEL *                         
TOP                           
DOWN 500                       
MOVE * 1 5089                 
S                             
L                             
END                           
The DOWN 5090/DEL* deletes the original line 5090, the TOP/DOWN 500/MOVE * 1 5089 moves line 500 to the line after line 5089; in other words it creates a new line 5090. I'd verify it works on a copy of your data before you try it on the real data set.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Apr 25, 2014 6:03 pm
Reply with quote

Bill, I am working out your idea.

Steve, Thank you. I have tried your solution as it is but losing a record and getting 1 less (actual number of records - 1). It moved it to line no.5088 where as I expected it to be at line no.5090.

Also, request you to explain the commands please.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Fri Apr 25, 2014 6:24 pm
Reply with quote

E is the builtin TSO line editor. Now that you know that you should be able to track down the manual that includes documentation about it.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Apr 25, 2014 7:44 pm
Reply with quote

Steve, achieved it with below set of commands !

Code:

E 'your-dataset' DATA NONUM
DOWN 500                                               
MOVE * 1 5090
S
END       
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Apr 25, 2014 8:00 pm
Reply with quote

This is an editor. Your original data is lost. So have a back-up step beforehand.

It'll never fail? If that job ever has an operator cancel, it will be in that step. After the delete and before anything else.

Those of your colleagues aware of the TSO Editor will be, let's say, limited in number.

You are also running TSO (in batch) to get it done.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Fri Apr 25, 2014 8:30 pm
Reply with quote

ramsri wrote:
... Also, request you to explain the commands please.
The manual is TSO/E Command Reference for your z/OS release. As Mr. Clouston says, this is the ancient TSO/E line mode editor.

E ... starts the editor
V (verify) Echos back changes
DOWN ... Move the current line pointer.
DEL * Delete the current line.
TOP Set the current line as the top of the data set.
MOVE Move lines. The MOVE subcommand is one of the few enhancements since the original TSO days.
S Save
L List
END Exit the editor

The way I read the topic starter was you wanted to replace line 5090 with line 500.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Apr 25, 2014 8:50 pm
Reply with quote

Thanks Steve. What size of dataset can be edited like this? What would be the MAX size? Is it again system dependant? Sometimes, few datasets go into browse mode when try to edit.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Apr 25, 2014 9:11 pm
Reply with quote

This is TSO Edit, not ISPF. You know nothing about TSO Edit.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Fri Apr 25, 2014 10:18 pm
Reply with quote

ramsri wrote:
Thanks Steve. What size of dataset can be edited like this? What would be the MAX size? Is it again system dependant? Sometimes, few datasets go into browse mode when try to edit.
Too many questions.

The max size is somewhat indeterminate. It allocates a temporary data set and copies the data set you are editing to it. To test the edit script I built a 6000 line data set. The limit is determined by the size of the temporary data set. ISPF, on the other hand, copies the data set you are editing to storage, and that determines the size limit.

I use the line mode edit fairly often for two reasons.
  • I often prefer a different line number sequence when I renum the line numbers than ISPF RENUM uses. Recently I've been working on a program that was close to 500 lines. When it was less than 500 lines I used RENUM 200000 200000. Now that it has popped up over 500 lines I use RENUM 100000 100000.
  • The ISPF change command effectively imposes size constraints on the strings. When I need longer strings the TSO EDIT change command is often more convenient, though the ISPF CHANGE anf FIND commands are far more powerful.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Fri Apr 25, 2014 11:45 pm
Reply with quote

ramsri wrote:
... I have tried your solution as it is but losing a record and getting 1 less (actual number of records - 1). It moved it to line no.5088 where as I expected it to be at line no.5090. ...
"Move" in this context usually means to delete the source line. This will change the relative line number of the remaining lines. This is what is in the data set after I ran the script.

LINE 498
LINE 499
LINE 501
LINE 502
...
LINE 5088
LINE 5089
LINE 500
LINE 5091
LINE 5092

The line numbers in the data set were prepared when I built the data set before I ran the TSO script so I could quickly verify the TSO script ran as I expected. The LINE 5089 line is relative line 5088 because the LINE 500 line was deleted.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts how to complete the end of a record w... DFSORT/ICETOOL 2
No new posts Sort based on the record type DFSORT/ICETOOL 1
Search our Forums:

Back to Top