Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
File Format using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: File Format using SORT
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10311
Location: italy

PostPosted: Mon Jan 18, 2010 6:33 pm    Post subject: Reply to: File Format using SORT
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    Post subject: File Format using SORT
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    Post subject: Reply to: File Format using SORT
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 Moderator


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

PostPosted: Mon Jan 18, 2010 11:44 pm    Post subject:
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    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Tue Jan 19, 2010 4:28 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 1 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 pm
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us