View previous topic :: View next topic
|
Author |
Message |
Richy12
New User
Joined: 29 May 2013 Posts: 22 Location: India
|
|
|
|
Consider my file has this data -
0092138C
8393293C
3923933C
With this data, I need to build queries as given below -
DELETE FROM TABLENAME WHERE FIELD_ONE='009213' and FIELD_TWO='8C';
DELETE FROM TABLENAME WHERE FIELD_ONE='839329' and FIELD_TWO='3C';
DELETE FROM TABLENAME WHERE FIELD_ONE='392393' and FIELD_TWO='3C';
I usually write a SORT or download it to textpad to build queries. Is it possible to do this with ISPF commands? |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Through Rexx it should be achievable |
|
Back to top |
|
|
Richy12
New User
Joined: 29 May 2013 Posts: 22 Location: India
|
|
|
|
With ISPF commands? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Yes, but why would you want to use ISPF commands when native REXX will do the same thing.
You have the input record layout defined, so just parse that and insert it into the command syntax. |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
I have used Rexx programs to do this sort of thing, but lately I have been using SORT. IMO it is by far the easiest way to do it, and I am a lazy programmer who always tries to find the easiest way to do anything. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
don.leahy wrote: |
I have used Rexx programs to do this sort of thing, but lately I have been using SORT. IMO it is by far the easiest way to do it, and I am a lazy programmer who always tries to find the easiest way to do anything. |
I'd call that being efficiency concious |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
why not generate the file as
Code: |
DELETE FROM TABLENAME WHERE FIELD_ONE='009213' and FIELD_TWO='8C';
DELETE FROM TABLENAME WHERE FIELD_ONE='839329' and FIELD_TWO='3C';
DELETE FROM TABLENAME WHERE FIELD_ONE='392393' and FIELD_TWO='3C'; |
Rather than
Code: |
0092138C
8393293C
3923933C |
|
|
Back to top |
|
|
Richy12
New User
Joined: 29 May 2013 Posts: 22 Location: India
|
|
|
|
Yes.. I can generate the file with the necessary queries instead of the values only..
And ofcourse, there is always DFSORT which makes these sort of things to be easily done...
I came across few ispf commands like P'.', P'=', p'>' , TS (text split), TF80(to change the record length) etc.. So, I was just curious to know if it was possible thru' ispf commands.. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
Your examples are editor commands, not ISPF commands.
To answer your question, yes, most of it can be done with editor commands:
bounds
shift
overlay |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Hi Richy,
If I understand correctly, you don't want a macro.. just a series of ISPF editor commands. In one word, answer is yes.
Try this -
BNDS 7 72
BLOCK SHIFT 55 (This should take the last two chars to desired column)
(This is not editor command. You will have to select the lines and use )) to shift the block)
BNDS 1 60
BLOCK SHIFT 39
C ALL P'===============' 1 'DELETE FROM '
C ALL P'===============' 13 'TABLENAME WHERE'
C ALL P'=' 29 "FIELD_ONE='"
You get the idea.. |
|
Back to top |
|
|
Richy12
New User
Joined: 29 May 2013 Posts: 22 Location: India
|
|
|
|
thank you all for the responses...
agkshirsagar.. i would try this tomorrow.. |
|
Back to top |
|
|
Richy12
New User
Joined: 29 May 2013 Posts: 22 Location: India
|
|
|
|
It worked. Thank you once again:) |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Glad to know it helped! |
|
Back to top |
|
|
|