|
|
| Author |
Message |
raajan_p
New User
Joined: 19 Sep 2005 Posts: 18
|
|
|
|
I have a ps file. Due to a problem in ftp the contents of the file are reversed. Now I want manipulate this file to get the original contents with the help of jcls. Can you help me? |
|
| Back to top |
|
 |
References
|
|
 |
spanda
New User
Joined: 31 Aug 2005 Posts: 49 Location: U.K.
|
|
|
|
Could you be a little more specific about your problem? Do you mean the file contents are just in reverse sort order (last record appearing at the top)?
If the contents of your file are simply appearing upside down, then you could probably sort them in the reverse order, provided the file has a sort key.
Panda. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4684 Location: San Jose, CA
|
|
|
|
| Quote: |
| If the contents of your file are simply appearing upside down, then you could probably sort them in the reverse order, provided the file has a sort key. |
And if records don't have a key, you can add a sequence number to each record with DFSORT's INREC statement, sort the records descending on the sequence number with DFSORT's SORT statement, and then remove the sequence numbers with DFSORT's OUTREC statement. |
|
| Back to top |
|
 |
raajan_p
New User
Joined: 19 Sep 2005 Posts: 18
|
|
|
|
Thanks a lot for replies.
In my case consider the following details
Input file
record length-80
contains 50 records
do to problem in FTP the output file now is in following format
record length-80
contains 50 records
but each record has been reversed. for eg
before FTP the value present in 1st byte is now present in 80th byte after FTP.
similarly value at 2nd byte is now present in 79th byte after FTP and so on.
how can i get back the original format. can it be done through JCL.
|
|
| Back to top |
|
 |
spanda
New User
Joined: 31 Aug 2005 Posts: 49 Location: U.K.
|
|
|
|
It may not be so easy to reverse the data in the record simply by the use of JCL. Other forum users may have ideas.
I believe you will have to use some programming language (REXX may work best) to fix your problem.
Being an assembler developer, I can think of the MVCIN instruction for reversing the order of the bytes of a string or a record. I think I am getting carried away from the subject here.
Panda. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4684 Location: San Jose, CA
|
|
|
|
rajaan_p,
Here's a DFSORT job that will do what you asked for:
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//SORTOUT DD DSN=... output file (FB/80)
//SYSIN DD *
OPTION COPY
OUTREC FIELDS=(80,1,79,1,78,1,77,1,76,1,75,1,74,1,73,1,72,1,71,1,
70,1,69,1,68,1,67,1,66,1,65,1,64,1,63,1,62,1,61,1,
60,1,59,1,58,1,57,1,56,1,55,1,54,1,53,1,52,1,51,1,
50,1,49,1,48,1,47,1,46,1,45,1,44,1,43,1,42,1,41,1,
40,1,39,1,38,1,37,1,36,1,35,1,34,1,33,1,32,1,31,1,
30,1,29,1,28,1,27,1,26,1,25,1,24,1,23,1,22,1,21,1,
20,1,19,1,18,1,17,1,16,1,15,1,14,1,13,1,12,1,11,1,
10,1,09,1,08,1,07,1,06,1,05,1,04,1,03,1,02,1,01,1)
/*
|
|
|
| Back to top |
|
 |
spanda
New User
Joined: 31 Aug 2005 Posts: 49 Location: U.K.
|
|
|
|
Frank,
That is a definitely a nice way reversing the bytes on a FB record. Could the same (or something similar) be used for VB records?
Any Syncsort method to reverse a VB record, without actually having to write a utility?
Thanks,
Panda. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4684 Location: San Jose, CA
|
|
|
|
| Quote: |
| That is a definitely a nice way reversing the bytes on a FB record. Could the same (or something similar) be used for VB records? |
For VB, you just need to take the 4-byte RDW into account, e.g.
| Code: |
OUTREC FIELDS=(1,4,84,1,83,1,82,1,81,1,80,1,79,1,78,1,77,1,76,1,75,1,
...
... 05,1)
|
|
|
| Back to top |
|
 |
spanda
New User
Joined: 31 Aug 2005 Posts: 49 Location: U.K.
|
|
|
|
But in a VB file, the records may be of different lengths. And the OUTREC statement you've suggested assumes that the input record length is 80.
Any thoughts on this?
Thanks,
Panda. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4684 Location: San Jose, CA
|
|
|
|
| Quote: |
| But in a VB file, the records may be of different lengths. And the OUTREC statement you've suggested assumes that the input record length is 80. |
Yes, that's what I assumed since you didn't say otherwise. For a true VB file, you'd need to use IFTHEN to set up a different BUILD for each record length, e.g.
| Code: |
OUTREC IFTHEN=(WHEN=(1,2,BI,EQ,+6),
BUILD=(1,4,6,1,5,1)),
IFTHEN=(WHEN=(1,2,BI,EQ,+7),
BUILD=(1,4,7,1,6,1,5,1)),
...
|
Rather tedious, but it can be done if you have DFSORT with the Dec, 2004 PTF for IFTHEN. |
|
| Back to top |
|
 |
|
|
|