IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

File Format using SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sibi Yohannan

New User


Joined: 15 Apr 2009
Posts: 47
Location: Bangalore

PostPosted: Mon Jan 18, 2010 6:29 pm
Reply with quote

Hi, please advice me on the below query.

We receive a FILE from a non-Mainframe system, each data is seperated by Tilde Sign (~) as below

Code:
12345~STATUS-1    ~12/15/2009~
99999~STATUS-2    ~12/15/2009~
88888~STATUS-3    ~12/15/2009~


We use a SORT to get the ~ removed and further this fisle is used by our Programs.

Recenly we found that some data is coming as below with a Format change compared to the rest of the Data

12345~STATUS-1 ~12/15/2009~
66666~STATUS-2 ~12/15/2009~

99999~STATUS-3 ~12/15/2009~
22222~STATUS-3 ~12/15/2009~


that is in the top 2 red ones, 12/15/2009 starts 2 char length in advance compared to the regular format.

Upon this we concluded that this issue cannot be resolved at the source system and need to identify a solution at our Mainframe receiving system.

Can we use the SORT to modify the input file in the above case to get a Synchronized output file in both the above mentioned cases?

That means in the case-2 input file I need an output file in the below format.....

Code:
12345STATUS-112/15/2009     
66666STATUS-212/15/2009     
99999STATUS-312/15/2009 
22222STATUS-312/15/2009
and the las one too
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Jan 18, 2010 6:33 pm
Reply with quote

unless You repost using the code tags we will not be able to see any difference in the data

edited Your post adding the code tags to the first occurrence of the records to show how the result should look like
Back to top
View user's profile Send private message
sibi Yohannan

New User


Joined: 15 Apr 2009
Posts: 47
Location: Bangalore

PostPosted: Mon Jan 18, 2010 6:37 pm
Reply with quote

Hi, please advice me on the below query.

We receive a FILE from a non-Mainframe system, each data is seperated by Tilde Sign (~) as below

Code:
Code:
12345~STATUS-1    ~12/15/2009~
99999~STATUS-2    ~12/15/2009~
88888~STATUS-3    ~12/15/2009~



We use a SORT to get the ~ removed and further this fisle is used by our Programs.

Recenly we found that some data is coming as below with a Format change compared to the rest of the Data

Code:
12345~STATUS-1 ~12/15/2009~
66666~STATUS-2 ~12/15/2009~
99999~STATUS-3       ~12/15/2009~
22222~STATUS-3       ~12/15/2009~


that is in the top 2 red ones, 12/15/2009 starts 2 char length in advance compared to the regular format.

Upon this we concluded that this issue cannot be resolved at the source system and need to identify a solution at our Mainframe receiving system.

Can we use the SORT to modify the input file in the above case to get a Synchronized output file in both the above mentioned cases?

That means in the case-2 input file I need an output file in the below format.....

Code:
12345STATUS-112/15/2009
66666STATUS-212/15/2009
99999STATUS-312/15/2009
22222STATUS-312/15/2009
Back to top
View user's profile Send private message
sibi Yohannan

New User


Joined: 15 Apr 2009
Posts: 47
Location: Bangalore

PostPosted: Mon Jan 18, 2010 6:37 pm
Reply with quote

I have updated the request,
please let me know for any furher details.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Jan 18, 2010 11:44 pm
Reply with quote

If I understand correctly what you're trying to do, a DFSORT job like the following should do it.

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
12345~STATUS-1 ~12/15/2009~
66666~STATUS-2 ~12/15/2009~
99999~STATUS-3       ~12/15/2009~
22222~STATUS-3       ~12/15/2009~
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC OVERLAY=(1,33,SQZ=(SHIFT=LEFT,PREBLANK=C'~'))
/*
Back to top
View user's profile Send private message
sibi Yohannan

New User


Joined: 15 Apr 2009
Posts: 47
Location: Bangalore

PostPosted: Tue Jan 19, 2010 10:59 am
Reply with quote

Thanks for your advice.

Lets consider the below format

Code:
EMP-ID  COMP-NAME             EMP-JOIN-DT       EMP-ADDRESS
11111   ABC Corporation     12/12/1998          HIGHWAY STREET-1
22222   COMPANY A             09/02/2001        PARK VIEW SIDE
99999   X-COM                 02/05/2004        AVENUE ROAD


Here the first EMP-JOIN-DT is aligned wrongly, advanced by CHAR length. This wrong alognment does happen for some of the records in the input file, thats where we are facing the problem. In this case the output will looks like

Code:
11111ABC Corporation12/12/1998HIGHWAY STREET-1
22222COMPANY A09/02/2001PARK VIEW SIDE
99999X-COM02/05/2004AVENUE ROAD


Here everything is merged together irrespective of each data length. COMP-NAME can have a maximum of 20 Chars. There is no fixed start point for the EMP-JOIN-DT after the COMP-NAME.

Is it possible to have a fixed format like the below one using SORT.


Code:
11111ABC Corporation  12/12/1998 HIGHWAY STREET-1
22222COMPANY-A        09/02/2001 PARK VIEW SIDE
99999X-COM            02/05/2004 AVENUE ROAD


Please advice and correct me if I am wrong.
Back to top
View user's profile Send private message
sibi Yohannan

New User


Joined: 15 Apr 2009
Posts: 47
Location: Bangalore

PostPosted: Tue Jan 19, 2010 11:27 am
Reply with quote

Please ignore the above post
I believe the simplest way to present this query is as below.

I have an input file in the below format

Code:
60~ABC Corporation             ~OVERRIDDEN  ~12/15/2009~     ~ 
67~COMPANY X                   ~OVERRIDDEN  ~12/15/2009~     ~ 
42~PLATINUM CORP               ~OVERRIDDEN  ~12/15/2009~     ~ 
48~COMP                        ~OVERRIDDEN  ~12/15/2009~     ~ 
07~SYSTEMS LTD                 ~ On Hold ~12/15/2009~      ~   
32~CORP-1                      ~ On Hold ~12/15/2009~      ~   


(2)~ (20) ~ (12) ~ (10) ~ (4 SPACES) ~

Each data is seperated by a tilde sign. But only where On HOLD comes, the data starts just at "V" position of OVERRIDDEN and the data starts by 2 Char length in advance, there onwards the rest of the data format alos varies.

The output format I expect is

Code:
60ABC Corporation     OVERRIDDEN  12/15/2009    ABC
67COMPANY X           OVERRIDDEN  12/15/2009    ABC
42PLATINUM CORP       OVERRIDDEN  12/15/2009    ABC
48COMP                OVERRIDDEN  12/15/2009    ABC
07SYSTEMS LTD         On Hold     12/15/2009    ABC
32CORP-1              On Hold     12/15/2009    ABC


Hope this explains in a better way.
Please advice and correct me If I am wrong.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Jan 19, 2010 4:28 pm
Reply with quote

Hi,

this maybe a way to get the result
Code:
//S1       EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                     
60~ABC CORPORATION             ~OVERRIDDEN  ~12/15/2009~     ~     
67~COMPANY X                   ~OVERRIDDEN  ~12/15/2009~     ~     
42~PLATINUM CORP               ~OVERRIDDEN  ~12/15/2009~     ~     
48~COMP                        ~OVERRIDDEN  ~12/15/2009~     ~     
07~SYSTEMS LTD                 ~ ON HOLD ~12/15/2009~      ~       
32~CORP-1                      ~ ON HOLD ~12/15/2009~      ~       
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                     
 OPTION COPY                                                       
 INREC PARSE=(%00=(ENDBEFR=C'~',FIXLEN=02),                         
              %01=(ENDBEFR=C'~',FIXLEN=20),                         
              %02=(ENDBEFR=C'~',FIXLEN=12),                         
              %03=(ENDBEFR=C'~',FIXLEN=10)),                       
        BUILD=(%00,%01,%02,%03)                                     
 OUTREC BUILD=(1,22,23,12,SQZ=(SHIFT=LEFT,MID=C' '),               
               35,10,C'    ABC',80:X)                               
/*                                                                 


Gerry
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Populate last day of the Month in MMD... SYNCSORT 2
Search our Forums:

Back to Top