Posted: Tue Apr 26, 2011 5:54 am Post subject: Extract data from flat flie based on condition using SORT
I've a file with LRECL=1200, which has client addresses starting from position 326 to 505 (total 180 bytes).
This address is split into 6 fields, each of 30bytes lenth.
address-line-1 from 326 to 355
address-line-2 from 356 to 385
address-line-3 from 386 to 415
address-line-4 from 416 to 445
address-line-5 from 446 to 475
address-line-6 from 476 to 505
But, currently we are storing the address in three contiguous fileds only(90bytes). so, the address can be
address-line-1 thru address-line-3 (position 326 to 415) or
address-line-2 thru address-line-4 (position 356 to 445) or
address-line-3 thru address-line-5 (position 386 to 475) or
address-line-4 thru address-line-6 (position 416 to 505)
I've a 3bytes numberic field in position 323 of this file which tells me from which position the address is starting.
Now, I need to extract the 90 bytes address from this file to another file based on the value in position 323.
If position 323 has 31 then i need to extract the address from address-line-1 thru address-line-3 (position 326 to 415)
If position 323 has 61 then i need to extract the address from address-line-2 thru address-line-4 (position 356 to 445)
If position 323 has 91 then i need to extract the address from address-line-3 thru address-line-5 (position 386 to 475)
If position 323 has 121 then i need to extract the address from address-line-4 thru address-line-6 (position 416 to 505)
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Tue Apr 26, 2011 10:26 am Post subject:
koolspark,
Unless I am missing something isn't it a simple request of using IFTHEN statements to check the contents at position 323 and build the output?
Use the following DFSORT JCL which will give you the desired results. If the contents at pos 323 is 31,61,91 or 121 it will create a 90 byte padded with spaces. ( Last when=none statement)
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