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

SYNCSORT-write records next to next !


IBM Mainframe Forums -> JCL & VSAM
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: Sat Feb 26, 2011 10:44 am
Reply with quote

Hi,

Input File: LRECL=8, RECFM=FB
Code:

RECORD01
RECORD02
RECORD03
RECORD04
.......
.......
RECORDnn


I have the above input file which has record one after another. I want to copy those records into output dataset with LRECL=16, RECFM=FB but records written next to next.

Expected Output-1: LRECL=16,RECFM=FB
Code:

RECORD01RECORD02
RECORD03RECORD04
..........
..........
RECORDnn


Expected Output-2: LRECL=24,RECFM=FB
Code:

RECORD01RECORD02RECORD03
RECORD04RECORD05RECORD06
..........
..........
RECORDnn


Would you please let me know how to achieve it using SORT? Also, what changes in control cards need if it has to be three records per line?

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

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat Feb 26, 2011 5:57 pm
Reply with quote

ramsri,

Here's a Syncsort job which works for your requirement (Expected Output-2). It can be modified to get Output-1 as well.
Code:
//STEP01   EXEC PGM=SORT                                   
//SYSOUT   DD   SYSOUT=*                                   
//SORTOUT  DD   SYSOUT=*                                   
//SORTIN   DD   *                                           
RECORD01                                                   
RECORD02                                                   
RECORD03                                                   
RECORD04                                                   
RECORD05                                                   
RECORD06                                                   
RECORD07                                                   
RECORD08                                                   
//SYSIN    DD   *                                           
  INREC IFTHEN=(WHEN=GROUP,RECORDS=3,PUSH=(81:ID=5,SEQ=1)),
        IFTHEN=(WHEN=INIT,OVERLAY=(87:1,8,16Z)),           
        IFTHEN=(WHEN=(86,1,ZD,EQ,2),OVERLAY=(095:1,8)),     
        IFTHEN=(WHEN=(86,1,ZD,EQ,3),OVERLAY=(103:1,8))     
  SORT FIELDS=(81,5,CH,A)                                   
  SUM FIELDS=(95,4,99,4,103,4,107,4),FORMAT=BI             
  OUTREC BUILD=(87,24) 
SORTOUT had
Code:
RECORD01RECORD02RECORD03 
RECORD04RECORD05RECORD06 
RECORD07RECORD08                       
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Mar 01, 2011 3:10 pm
Reply with quote

Arun, thanks. I'll try it and come back.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Mar 01, 2011 3:20 pm
Reply with quote

Hi Arun, I've tried your code and got expected results icon_biggrin.gif

I've modified value of RECORDS parameter from 3 to 2 and got the results.

Code:

//SYSIN    DD *                                             
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:ID=5,SEQ=1)),


One thing I would like to ask why to use FORMAT=BI.

Code:

SUM FIELDS=(95,4,99,4,103,4,107,4),FORMAT=BI


Thanks a lot.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Mar 04, 2011 12:36 am
Reply with quote

The objective of the binary SUM here is to 'ADD' binary zeroes and the binary value of 'RECORDnn' giving 'RECORDnn' itself. It might help if you have a look at the intermediate output by removing the SUM and OUTREC statements.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Fri Mar 04, 2011 9:12 am
Reply with quote

Hi Arun, I will try and see it.

Thanks.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top