How to remove extra spaces by using sync sort

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
sandeepforever007
Member
Posts: 10
Joined: Wed Apr 02, 2014 9:59 pm

How to remove extra spaces by using sync sort

Post by sandeepforever007 » Thu Apr 10, 2014 3:01 pm

Hi Team,

We have a PS File with the following format
Login ID Salary ID
F12345
A12345 A12345
C12345
D12345 D12345

We are using SYNCSORT in the Job to format the file and we are getting the output in the following fashion

INREC FIELDS=(1:1,6,
7:C',',
8:8,6,
14:C',')
SORT FILEDS=COPY



F12345, ,
A12345,A12345,
C12345, ,
D12345,D12345,

Could you please let us know if we can remove null columns as shown below

F12345,,
A12345,A12345,
C12345,,
D12345,D12345,


Please provide us the possibility for writting the code
With Regards,
Sandeep

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Thu Apr 10, 2014 3:21 pm

Code: Select all

 INREC IFTHEN=(WHEN=(8,6,CH,EQ,C' '),
                  BUILD=(1,6,
                         C',,',
                         80:X)),
       IFTHEN=(WHEN=NONE,
                  BUILD=(1,6,
                         C',',
                         8,6,
                         C',',
                         80:X))
I've assumed LRECL of 80, but change that if you need to. Understand what it is doing before using it.

sandeepforever007
Member
Posts: 10
Joined: Wed Apr 02, 2014 9:59 pm

Post by sandeepforever007 » Thu Apr 10, 2014 3:38 pm

Hi Williams,

Thanks for the fast responce ,

We are having input file in the following format

AAAAA,, BBBBBBB,
AAAAA,BBBBBBB,,

COuld you please let us know if the code mentioned above will work to my scenerio
AAAAA,,BBBBBBB, -- > 3 Columns
AAAAA,BBBBBBB,, -- > 3 Columns

Let us know if we need to remove Fields parameter which we mentioned earlier

Sorry for Disturbing u again

Hope understood our problem

sandeepforever007
Member
Posts: 10
Joined: Wed Apr 02, 2014 9:59 pm

Post by sandeepforever007 » Thu Apr 10, 2014 4:50 pm

Hi ,

When we execute the code mentioned we are still getting the spaces between the two commas .

COuld you please guide us

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Thu Apr 10, 2014 6:51 pm

You've changed the input. How could you expect code for a different input to work on something else that you throw at it?

FIELDS is equal to BUILD. FIELDS is there for backwards-compatibilty, it is much clearer to use BUILD, which does not have multiple meanings in SORT (whereas FIELDS does).

You need to, catefully, re-post your data inside the Code tags, so that the data is in a fixed-font and it looks like a green screen, like the code in my previous response. Click on Quote there if you need to see how.

Show all the possible variations of input that you want to deal with, and show the data has having representative values (like we need to know if you can have embedded spaces, perhaps).

sandeepforever007
Member
Posts: 10
Joined: Wed Apr 02, 2014 9:59 pm

Post by sandeepforever007 » Fri Apr 11, 2014 8:44 am

Hi Sir,

Extremely sorry for the confusion created by me in my earlier posts .

I am having the input file in the following format

Pos 1 - 5 EMP_ID
POS 6 EMPTY SPACE
POS 7-9 LAST NAME
POS 10 EMPTY SPACE
POS 11-13 FIRST NAME

Pls find the input file attached

Code: Select all

 =COLS> ----+----1----+--
 ****** *****************
 '''''' A1234 XYZ TRE    
 '''''' B1234 TRE HF     
 '''''' A5643 RRR UUU    
 '''''' B4637 DDD YDS    
 '''''' C2345 DDD RMS    
 '''''' X1234 DDD CMS    
 '''''' Y1234 DDD YRE    
 ''''''                  

Desired OUTPUT :

1. FIRST COLUMN SHOULD HAVE EMPID FOLLOWED BY COMMA
2. SECOND COLUMN - IF EMPID STARTS WITH A/B THEN EMPID SHOULD BE DISPLAYED IN SECOND COLUMN DELIMETED BY COMMA,
IF NOT MATCHING , THEN SIMPLY DELIMETED COLUMN BY COMMA
3.THIRD COLUMN - LAST NAME DELIMITED BY COMMA
4.FOURTH COLUMN - IF EMPID STARTS WITH C THEN EMPID SHOULD BE DISPLAYED DELIMETED BY COMMA , ELSE SIMPLY DELIMTED BY COMMA
5.FIFTH COLUMN - FIRSTNAME

Code: Select all


A1234,A1234,XYZ,,TRE 
B1234,B1234,TRE,,HF  
A5643,A5643,RRR,,UUU 
B4637,B4637,DDD,,YDS 
C2345,,DDD,C2345,RMS 
X1234,,DDD,,CMS      
Y1234,,DDD,,YRE      

Could you please help us in resolving this post
WithRegards
Sandeep

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others