View previous topic :: View next topic
|
Author |
Message |
Nitin Bhargava
New User
Joined: 22 May 2012 Posts: 32 Location: india
|
|
|
|
Hi All,
I want to check spaces on a particular position of a file and if found want to displace the record by some bytes.
Input file is having following record
Code: |
50 NEWYORK MICHAEL JOHN US CITIZEN |
I want to check the first space encountered from position 11th and then start the next variable from position 30th of my output file.
Output file will look like:
Code: |
50 NEWYORK MICHAEL JOHN US CITIZEN |
File is a FB and LRECL as 1000.
Regards |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
INREC IFTHEN check for space if it satisfies do the BUILD as per your requirement
Also forgot to ask what will be the lenghth of the output if your input has space in 11th column and has data in rest of the column till 1000 |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Your data doesn't match your description.
Please show sufficient examples and expected output to fully describe what you want. |
|
Back to top |
|
|
Nitin Bhargava
New User
Joined: 22 May 2012 Posts: 32 Location: india
|
|
|
|
Hi,
Even though the file is of 1000 bytes the record is max of 480 byes so there are no chances of truncation.
My question is: I want to check the first space encountered starting from 11th byte. Suppose the first space is at 17th byte, In that case I have to keep the first 17th byte as it is and rest of the data should start from a fixed position 30th byte.
The other situtation could be: First space is encountered at 15th byte, In that case I have to keep the first 15th byte as it is and rest of the data should start from a fixed position 30th byte.
Please let me know am I clear now . |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
In your example, the first space after the 11th byte is the one before MICHAEL. |
|
Back to top |
|
|
Nitin Bhargava
New User
Joined: 22 May 2012 Posts: 32 Location: india
|
|
|
|
oops its a typo...Actually in my example NEWYORK is combined.
Anyway i want it to be checked from 11th byte itself. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, I'm not so sure if you can just stick NEWYORK itself together if you feel like it, but I've edited your original post to reflect this. |
|
Back to top |
|
|
Nitin Bhargava
New User
Joined: 22 May 2012 Posts: 32 Location: india
|
|
|
|
Do you think we could do this using sort or icetool. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hello,
If you post some input sample records with output records and explain all the possibilities, then someone will be able to give you a apt solution. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Beyond the 11th byte, are the positions of the remaining fields in the record variable?
Is this another attempt at your previous topic, which you seemed to lose interest in? |
|
Back to top |
|
|
Nitin Bhargava
New User
Joined: 22 May 2012 Posts: 32 Location: india
|
|
|
|
Hi Bill,
I did my previous one by dividing it in multiple steps. Since this one is a bit straight forward I am thinking not to increase the steps in my job.
Here are some more example for this one
Code: |
10 OHIO JAMES KART US CITIZEN
20 TOWN GORGE JUST US CITIZEN
|
Output expected
Code: |
10 OHIO JAMES KART US CITIZEN
20 TOWN GORGE JUST US CITIZEN
|
Regards |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You didn't answer, so let me ask in a different way.
Is your file
Fixed-length of "stuff"
Fixed-length of "name-stuff" to be re-arranged
Fixed-length of "rest-of-stuff"
Or
Fixed-length of "stuff"
Variably-positioned "stuff" including "name-stuff" to be rearranged
? |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Quote: |
I want to check spaces on a particular position of a file |
Quote: |
Even though the file is of 1000 bytes the record is max of 480 byes so there are no chances of truncation. |
I am confused here: by file do you mean dataset or record?
If your 'file' is 1000 bytes and lrecl is a max of 480 bytes I presume the maximum number of records is 2 but what is the minimum record length? What if your 'file' is empty? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
While your question is probably quite clear to you, it is not to everyone else. You need to clarify the info you have posted because it is confusing some (me<g>) of us.
Act like the max length (your 1000) is only 60. Then act like your 480 is only 20. Then show a few examples using these sizes (the ones you already have may work or they may need modification. |
|
Back to top |
|
|
|