View previous topic :: View next topic
|
Author |
Message |
ChowHan
New User
Joined: 16 Oct 2009 Posts: 15 Location: India
|
|
|
|
I was asked this question,
the input would be like say LRECL 80 (the interviewer was quite accommodating in this regard and ABCDE etc. don't refer to field names, it was indivdual characters in the record)
Code: |
ABCDEFGH
IJKLMNOP
QRSTUVWX
|
Output would be the same LRECL but with the whole record reversed
Code: |
HGFEDCBA
PONMLKJI
XWVUTSRQ
|
In my short career, I never faced such a business need, but in any case, is it possible to do it using SORT? ( I didn't ask whether they want to use DFSORT or SYNCSORT because I was flummoxed).
A cobol reverse function would do the needful very easily, With SORT I know it could be done the cumbersome way, I guess, building the record one char at a time, but is there any way to do this without using a huge sysin card? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I know of nothing automatic with either DFSORT or Syncsort, but you could do as you mention and build the reversed output one byte at a tme.
And also as you mention, there is not business need - it is just an exercise |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
I believe a combination of PARSE and SQZ functions can be used to do what you asked for. I've used that to reverse the CSV file. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
Back to top |
|
|
ChowHan
New User
Joined: 16 Oct 2009 Posts: 15 Location: India
|
|
|
|
I went thru most of the search results before posting the question, sorry...
But most of the results were regarding reversing the order of records (last record in input --->first record in o/p ). So i gave up after some time spent futilely clicking on links in first page of search results...
Thanks Anuj, I will try this solution tomorrow... I would suggest deleting my topic, but it seems it is a valid interview question that could help someone. But please delete if you feel it is redundant... my query is solved in any case . |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
ChowHan,
If it's just a rearrange of fields, I guess a simple INREC pass will do for the sample you have given. |
|
Back to top |
|
|
|