IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

SORT Format should be RECFM=VB,LRECL=350


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

New User


Joined: 27 Apr 2009
Posts: 23
Location: mumbai

PostPosted: Fri Jan 15, 2016 8:20 pm
Reply with quote

Hi ,

I have a input file in the below format.
-------------------------------------------------------------------------------------
Code:
SQL> SET ECHO OFF                                                     
SQL> SET HEADING OFF                                                 
SQL> SET TERMOUT OFF                                                 
SQL> SET FEEDBACK OFF                                                 
SQL> SET TRIMSPOOL ON                                                 
SQL> SET PAGESIZE 0                                                   
SQL> SET COLSEP ','                                                   
SQL> SELECT TZR,PROP_CODE,TO_CHAR(INV_DATE,'YYYY'),'3001',           
  2         TO_CHAR(INV_DATE,'YYYY-MM-DD'),'0',USER_NOTES             
  3    FROM OYT_XP_DAILY_SPREAD                                       
  4    WHERE INV_DATE  BETWEEN  TO_DATE('02/01/2018','MM/DD/YYYY')   
3,BADPT,2018,3001,2018-02-01,0                                       
                                                                     
                                                                     
3,MADPT,2018,3001,2018-02-02,0                                       
                                                                     
                                                                     
3,CADPT,2018,3001,2018-02-03,0   

------------------------------------------------------------------------
Below is the input file formate,RECFM=VB,LRECL=1028.

I want out to be written as below,
Code:
BADPT,2018,3001,2018-02-01,0                                     
MADPT,2018,3001,2018-02-02,0 
CADPT,2018,3001,2018-02-03,0 


the Format should be RECFM=VB,LRECL=350.

Now i tried the below sort card,

Code:
 SORT FIELDS=COPY                 
 INCLUDE COND=(5,2,CH,EQ,C'1,',OR,
               5,2,CH,EQ,C'2,',OR,
               5,2,CH,EQ,C'3,')   
 OUTREC FIELDS=(1:7,5),CONVERT


But it is not working.

Could you please advise.

Thanks,
Sen

Code'd
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Fri Jan 15, 2016 8:36 pm
Reply with quote

It's not clear what you are expecting CONVERT to do. You have no data which starts with '1,' or '2,'. Is that a typo in your sample?

Get rid of the OUTREC, don't use FIELDS on OUTREC (or INREC or OUTFIL OUTREC).

This may be what you want.

Code:
  INREC BUILD=(1,4,7)
Back to top
View user's profile Send private message
senthamizh

New User


Joined: 27 Apr 2009
Posts: 23
Location: mumbai

PostPosted: Fri Jan 15, 2016 8:51 pm
Reply with quote

The records in INPUT IS IN THE BELOW FORMATE(RCFM=VB,LRECL=1028)
Code:
SQL> SET ECHO OFF
SQL> SET HEADING OFF
SQL> SET TERMOUT OFF
SQL> SET FEEDBACK OFF
SQL> SET TRIMSPOOL ON
SQL> SET PAGESIZE 0
SQL> SET COLSEP ','
SQL> SELECT TZR,PROP_CODE,TO_CHAR(INV_DATE,'YYYY'),'3001',
2 TO_CHAR(INV_DATE,'YYYY-MM-DD'),'0',USER_NOTES
3 FROM OYT_XP_DAILY_SPREAD
4 WHERE INV_DATE BETWEEN TO_DATE('02/01/2018','MM/DD/YYYY')
3,BADPT,2018,3001,2018-02-01,0


3,MADPT,2018,3001,2018-02-02,0


3,CADPT,2018,3001,2018-02-03,0

After Sort i want ot extract only the below records from Input file and write it into outputfile.

BADPT,2018,3001,2018-02-01,0
MADPT,2018,3001,2018-02-02,0
CADPT,2018,3001,2018-02-03,0

The output file RECFM should be RECFM=FB,LRECL=350.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Fri Jan 15, 2016 9:42 pm
Reply with quote

You've been a member here for six years+. Please use the code-tags to preserve spacing.


Code:
  OUTFIL BUILD=(7,346),VTOF


Your INCLUDE was basically correct, except for the three conditions, which only need be one.
Back to top
View user's profile Send private message
senthamizh

New User


Joined: 27 Apr 2009
Posts: 23
Location: mumbai

PostPosted: Fri Jan 15, 2016 10:23 pm
Reply with quote

I am getting below error

Code:

 WER250A  INCLUDE/OMIT FIELD BEYOND RECORD       


when i use the below sort card
Code:

SORT FIELDS=COPY               
INCLUDE COND=(5,2,CH,EQ,C'3,')
OUTREC BUILD=(7,346),VTOF
Back to top
View user's profile Send private message
senthamizh

New User


Joined: 27 Apr 2009
Posts: 23
Location: mumbai

PostPosted: Fri Jan 15, 2016 10:29 pm
Reply with quote

i tried

Code:

SORT FIELDS=COPY             
INCLUDE COND=(5,2,CH,EQ,C'3,')
OUTFIL BUILD=(7,346),VTOF     


still getting the error:
Code:

WER250A  INCLUDE/OMIT FIELD BEYOND RECORD
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Fri Jan 15, 2016 10:49 pm
Reply with quote

Code:
  SORT FIELDS=COPY             
  INCLUDE COND=(5,2,CH,EQ,C'3,')
  OUTFIL IFTHEN=(WHEN=INIT,
                  OVERLAY=(351:X)),
         IFTHEN=(WHEN=INIT,
  BUILD=(7,342)),VTOF,VLTRIM=C' '     
Back to top
View user's profile Send private message
senthamizh

New User


Joined: 27 Apr 2009
Posts: 23
Location: mumbai

PostPosted: Fri Jan 15, 2016 10:58 pm
Reply with quote

I am able to get the result by using PARM='VLTESTI=1'
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Fri Jan 15, 2016 11:43 pm
Reply with quote

Next time explain what you mean by "not working", including any error messages in full.
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

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts COBOL VS SORT Utility for file format... COBOL Programming 6
No new posts Date format conversion DFSORT/ICETOOL 4
No new posts Copying data from prev record using SORT SYNCSORT 19
No new posts Combining more 4 files with sorted or... DFSORT/ICETOOL 3
This topic is locked: you cannot edit posts or make replies. Parsing more than 1000 columns in a s... SYNCSORT 10

Back to Top