Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

move a record from one line to other line

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: move a record from one line to other line
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    Post subject: Sample Data
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Fri Apr 25, 2014 3:23 pm    Post subject: Reply to: move a record from one line to other line
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 User


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

PostPosted: Fri Apr 25, 2014 4:39 pm    Post subject:
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    Post subject: Reply to: move a record from one line to other line
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: 1715
Location: UK

PostPosted: Fri Apr 25, 2014 6:24 pm    Post subject: Reply to: move a record from one line to other line
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    Post subject: Reply to: move a record from one line to other line
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Fri Apr 25, 2014 8:00 pm    Post subject: Reply to: move a record from one line to other line
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 User


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

PostPosted: Fri Apr 25, 2014 8:30 pm    Post subject: Re: Reply to: move a record from one line to other line
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    Post subject: Reply to: move a record from one line to other line
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Fri Apr 25, 2014 9:11 pm    Post subject: Reply to: move a record from one line to other line
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 User


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

PostPosted: Fri Apr 25, 2014 10:18 pm    Post subject: Re: Reply to: move a record from one line to other line
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 User


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

PostPosted: Fri Apr 25, 2014 11:45 pm    Post subject: Re: Reply to: move a record from one line to other line
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us