View previous topic :: View next topic |
Author |
Message |
Amit Manas Dubey Beginner
Joined: 22 Jun 2007 Posts: 3 Topics: 2
|
Posted: Thu Jul 05, 2007 6:05 am Post subject: Insert some chars in a column |
|
|
I have a Sequential file with LRECL 87. I have multiple records in the file with length 85 and the last two chars are spaces.
I want to insert some chars in Column 14 and 15 and shift the rest of the record to the right.
Any ideas how I can achieve that ?
Are there any Line commands that can be used ?
Best regards,
Amit. _________________ Manas |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Jul 05, 2007 6:35 am Post subject: |
|
|
Amit Manas Dubey,
1. Open the dataset in edit mode
2. Issue the following command at the command prompt and press enter
Code: |
X ALL ; F ' ' 86 ALL
|
3. now issue the following command at the command prompt and press enter
4.now tab over to the line numbers and enter the following the line command on the first line
5. Now go down to the last line and enter the following the line command on the last line
6. Press enter
7. Now enter the following command at the command prompt and press ENTER
Code: |
C ' ' C'YOUR STRING TO BE INSERTED' 14 NX ALL
|
8. Type RESET at the command prompt and voila you have desired results
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu Jul 05, 2007 6:43 am Post subject: |
|
|
Amit Manas Dubey,
If the QSAM file is FB, with non-variable records of length 87, yes, you can edit the file and using the BOUNDS (BNDS) primary command and using the SHIFT RIGHT Cols/Char [>> / ))] line commands you can accomplish this.
PF1, while in edit mode, I for index, then check b - look for bounds, and then look for line commands.
e.g.
at the command prompt- exclude all or x all
- Find all ' ' 86
- bnds 14 87
at this point, the only lines displayed are those with spaces in 86 and 87.
on each displayed line- enter the line command > (a greater than sign)
- place the cursor on pos 14 and enter the 2 characters that you want.
IF the lines that have spaces in 86 and 86 are the only lines that will have spaces in 14 and 15 after the shift right, and you are going to insert the exact same characters in each line at positions 14 & 15 then you can omit number 2 above, and instead- Change ALL ' ' 'yy' 14 15 NX
which is change all spaces in 14 and 15 of non-excluded lines to yy (yy is your constant that you want to place in 14 & 15.
Before you start, at the command line enter: Recovery On. This will allow you to enter UNDO (same as ctl-z in MS-Windows) in the event that you do something 'wrong'.
Also, I would duplicate your qsam file, work on the duplicate, and then run a compare on the two files to insure what you have changed is what you intended. If all is ok, delete the original and rename the modified.
START USING PF1 yeah, I am yelling!!!!
(edited by dbz to correct the bnds command) _________________ Dick Brenholtz
American living in Varel, Germany
Last edited by dbzTHEdinosauer on Thu Jul 05, 2007 7:04 am; edited 1 time in total |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu Jul 05, 2007 6:47 am Post subject: |
|
|
Kolusu,
excellent idea using the shift spaces command on the complete file instead of doing what I suggested: shift characters on only those that have spaces in 86 & 87. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
Amit Manas Dubey Beginner
Joined: 22 Jun 2007 Posts: 3 Topics: 2
|
Posted: Thu Jul 05, 2007 6:49 am Post subject: |
|
|
Thanks a lot.
This worked.
Amit. _________________ Manas |
|
Back to top |
|
 |
|
|