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

syncsort - data reformat


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Aug 29, 2013 7:05 pm
Reply with quote

Hi,

My input data (LRECL=80,RECFM=FB) looks like below:

Input:
Code:

XXXXXXXX TYPE=ENTRY,GROUP=ABCDEFGH,USRID=AZBCDEF
YYYYYYYY TYPE=ENTRY,GROUP=ABC123,USRID=ABZDBA   
ZZZZZZZZ TYPE=ENTRY,GROUP=XYZ01234,USRID=XYZMBT
AAAAAAAA TYPE=ENTRY,GROUP=GUNSH1P,USRID=CUGMIG


I want this data to be reformatted to below fashion:
The value appearing after "GROUP=" should sit at 1st column and value appearing after "USRID=" should sit at 21st column.

Expected Output:
Code:

----+----1----+----2----+----3
ABCDEFGH            AZBCDEF
ABC123              ABZDBA
XYZ01234            XYZMBT
GUNSH1P             CUGMIG


Please help.

Thanks.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu Aug 29, 2013 9:23 pm
Reply with quote

Looks like a simple PARSE.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Aug 29, 2013 11:01 pm
Reply with quote

Yes, "starting after" GROUP= and USERID=, "ending at" comma.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Aug 30, 2013 5:43 pm
Reply with quote

I have written this based on your suggestions but goes for a toss icon_sad.gif

Code:

//SYSIN    DD *                                             
  INCLUDE COND=(1,80,SS,EQ,C'GROUP=')                       
  INREC FIELDS=(31,22)                                     
  SORT FIELDS=(21,8,CH,A)                                   
  OUTREC PARSE=(%00=(ENDBEFR=C',U',FIXLEN=8),               
                %01=(STARTAFT=C'D=',ENDBEFR=C',',FIXLEN=7)),
         BUILD=(1:%00,21:%01,53X)                           


SYSOUT:
Code:

SYSIN :                                                           
  INCLUDE COND=(1,80,SS,EQ,C'GROUP=')                             
  INREC FIELDS=(31,22)                                             
  SORT FIELDS=(21,8,CH,A)                                         
  OUTREC PARSE=(%00=(ENDBEFR=C',U',FIXLEN=8),             
                %01=(STARTAFT=C'D=',ENDBEFR=C',',FIXLEN=7)),       
         BUILD=(1:%00,21:%01,53X)                                 
WER276B  SYSDIAG= 31702, 693460, 693460, 1437600                   
WER164B  23,428K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B     0 BYTES RESERVE REQUESTED, 1,012K BYTES USED           
WER146B  12K BYTES OF EMERGENCY SPACE ALLOCATED                   
WER108I  SORTIN   : RECFM=FB   ; LRECL=    80; BLKSIZE= 27920     
WER257I  INREC RECORD LENGTH =    22                               
WER027A  CONTROL FIELD BEYOND RECORD                               


Please help.

Thanks.
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Fri Aug 30, 2013 6:54 pm
Reply with quote

I don't have syncsort, but I tried something more simple like this in DFSORT and it's working fine.
Code:
 OPTION COPY                                                 
 INREC PARSE=(%00=(STARTAFT=C'GROUP=',ENDBEFR=C',',FIXLEN=08),
              %01=(STARTAFT=C'USRID=',FIXLEN=07)),           
 BUILD=(%00,%01)                                             
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Aug 30, 2013 7:51 pm
Reply with quote

mistah kurtz, thanks.......I got the below results with your job card -

Code:

ABCDEFGHAZBCDEF
ABC123  ABZDBA
XYZ01234XYZMBT
GUNSH1P CUGMIG


But, what was wrong with my sysin that it had to abend.......thanks.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 30, 2013 8:04 pm
Reply with quote

Look up the message.

Look at the sysout.

Take out the SORT statement.

Then look at your output.

From all this (if not from reading the control cards) you should realise that you are making a 22-byte record (the BUILD=) and then attempting to SORT if from start-position 21 for a length of eight. So, control field beyond end of record...
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top