Posted: Fri Feb 16, 2018 12:08 pm Post subject: Getting File from Unix(SAP) to mainframe and parse thru Sort
We are receiving the file from SAP (Unix server). It is a report in a.TXT file. When we received the file to mainframes, it could not recognize the End of Line character (X’25’) from unix.
FTP command to receive the file:
Code:
cd /out/
locsite wrap ïƒ (After using this command we were able to get all the data but it was wrapped)
get TST00005-001.20180215.062850.1.txt 'Host file’ (REPLACE
QUIT
Problem:
The data in the file is wrapped. We want it to be fixed 132 bytes like shown in Expected output.
Input:
We tried to parse the record using the below sort but only the first record was right. Rest of the records were still wrapped. I am not sure how we could use the REPEAT command, since we do not know how many Line Feed characters are available in this file.
Hi Kolusu,
Thanks for the suggestion. And, sorry I think I gave the sample input incorrectly. The requirement is to move any characters after X'25' to next line. When I used, ENDAT, it truncated the data after X'25'. I tried removing FIXLEN and just using ENDAT, but I get syntax error.
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2----+----3---
********************************* Top of Data **************************************** Top of Data **********************************
ABC00005 xxxxx xxxxx Accept.Corp GL-040 Page: 43071.
A000291 Sample Journals Report 02/15/2018.005
05:36:56.--------
-----------------------------------------------------------------------------------------------------------------------------..Company
Code: xxxx Document Type: XX Entry Date: 07/25/2017.Document Number: 999999999
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Feb 19, 2018 10:32 am Post subject:
tsharsri wrote:
Hi Kolusu,
Thanks for the suggestion. And, sorry I think I gave the sample input incorrectly. The requirement is to move any characters after X'25' to next line. When I used, ENDAT, it truncated the data after X'25'. I tried removing FIXLEN and just using ENDAT, but I get syntax error.
The first rule of seeking help is to pay attention to the questions asked and answer them. I asked you a question about transfer method and you did not even bother to answer that.
Secondly, you do need to use ENDAT but your Parse should have the maximum number to account for each record. For example if your input is LRECL 1340 (10 records + 10 delimiters) then you need a max of 10 parsed fields. The reason You need to have ENDAT is because you need to distinguish the records which are split across records. The record that does not have the delimiter is the one that is split across records, so you need to join that record. You need 2 passes to reconstruct the file.
So pay attention to what is being asked and suggested and then you work on it.
Sorry I missed to pay attention to your questions.
We used ASCII mode of transfer to recieve the file and used LOCSITE WRAP. The LRECL of the file is 133 bytes.
Code:
cd /out/
ASCII
locsite wrap
get ABC00005-006.20180215.063242.6.txt 'ABC.ABC00005.RPT006.REC133' (REPLACE
Some records have 1 delimiter and some have 2. Whenever there is an empty line between two records, we are getting 2 delimiters. Otherwise, its one delimiter per record.
We are requesting the source team to add carriage return character along with the line feed to the file but not sure if they will be able to add it. _________________ Thanks
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Feb 19, 2018 11:32 am Post subject:
tsharsri wrote:
Sorry I missed to pay attention to your questions.
We used ASCII mode of transfer to recieve the file and used LOCSITE WRAP. The LRECL of the file is 133 bytes.
It is LOCSITE WRAPRECORD.
tsharsri wrote:
Some records have 1 delimiter and some have 2. Whenever there is an empty line between two records, we are getting 2 delimiters. Otherwise, its one delimiter per record.
We are requesting the source team to add carriage return character along with the line feed to the file but not sure if they will be able to add it.
If your records only have a maximum of 2 delimiters then you use the following control cards. I assumed that your 2 delimiter records are always an all spaces line.
Thanks a lot. I tried both these solutions. In some lines, the strings after the x'25' got trimmed.
The source team has finally agreed to write file with CRLF character and so the file is fixed at it's source.
Thank you again. _________________ Thanks
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum