Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need to insert spaces in a file (RECFM=VB) using Syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
balimanja

New User


Joined: 14 Aug 2007
Posts: 38
Location: Bangalore

PostPosted: Wed Sep 30, 2009 12:04 pm    Post subject: Need to insert spaces in a file (RECFM=VB) using Syncsort
Reply with quote

Hi all,

I am facing problem in inserting 10 spaces in a file (RECFM=VB). I tried to search for help on the net but could only find this: A helpful Tip from Bill Qualls - Assembler Guru.

Basically, I need to take the record from a VB file, insert spaces at a certain location and then write that record to a VB file. All this using SYNCSORT.

Details:
Input File Length: 504 (500 data + 4 RDW)

From this input file, I need to insert 10 spaces starting from 5th data position (i.e. 10th actual column) to 14th data position (i.e. 19th actual column). Luckily, the last 25 columns in the record is FILLER, so need not bother to increase the file length of the new output file. This FILLER region can be used. This modified record must be written to a file of the same record length of 504.

Output File Length: 504 (500 data + 4 RDW)

Input Record Sample:
Code:

RDW DATA(TILL 500)
----+----1----+----2----+----3----+----4
    ABCDEFGHIJ.....


Output Record Sample:
Code:

RDW DATA(TILL 500)
----+----1----+----2----+----3----+----4
    ABCDEXXXXXXXXXXFGHIJ...


Please do let me know if there are any alternatives to achieve this without using VTOF or FTOV. I need to take the VB file as input and create a VB file output.

Unfortunately, we don't use DFSORT for which I have a lot of documentation with me. icon_sad.gif

Thank you very much...
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Sep 30, 2009 12:22 pm    Post subject:
Reply with quote

For what you need to do, I think that the DFSORT syntax will be almost if not exactly the same
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Sep 30, 2009 12:25 pm    Post subject:
Reply with quote

Hello There ,

Please try this. I am not able to test it as i dont have syncsort currently

Code:

Sort fields=copy
outrec fields=(5,4,10X,16:9,490)


Hope it should work
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 38
Location: Bangalore

PostPosted: Wed Sep 30, 2009 12:37 pm    Post subject:
Reply with quote

Hi,

Here is my sort control card, please let me know where I have gone wrong.

Code:

SORT FIELDS=COPY       
OUTREC BUILD=(1:1,4,   
             5:5,4,   
             10:10X,   
             20:10,485)


The error that I get is as below:

Code:

WER108I  SORTIN   : RECFM=VB   ; LRECL=   504; BLKSIZE= 27998           
WER237I  OUTREC RECORD LENGTH =   504                                   
WER110I  SORTOUT  : RECFM=VB   ; LRECL=   504; BLKSIZE= 27998           
WER410B  7,848K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B     0 BYTES RESERVE REQUESTED, 2,264K BYTES USED               
WER244A  OUTREC - SHORT RECORD                                         
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                           


All the record lenghts are same, but it says OUTREC - SHORT RECORD
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Sep 30, 2009 1:57 pm    Post subject:
Reply with quote

Hello Balimanja,

Please refer below post. You need to change PArm parameter

http://www.ibmmainframes.com/viewtopic.php?t=43186&highlight=short+record
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 38
Location: Bangalore

PostPosted: Wed Sep 30, 2009 2:33 pm    Post subject:
Reply with quote

Hi Ekta. I did go through the post, I am still confused. I tried using VLTEST=0, hoping that the records lengths will not be considered but still it gives me the same error which says that OUTREC - SHORT RECORD. I am not familiar with using the PARM options.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Sep 30, 2009 3:00 pm    Post subject:
Reply with quote

In DFSORT, I usually use
Code:

Sort fields=copy
outrec fields=(5,4,10X,16:9)

When it picks up the rest of the VB record. Maybe it may also work for SYNCSORT
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Sep 30, 2009 3:04 pm    Post subject:
Reply with quote

Hello Balimanja,

Please try

Code:
EXEC PGM=SORT,PARM='VLTESTI=2'


Let us know the results.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Sep 30, 2009 3:16 pm    Post subject:
Reply with quote

http://www.ibmmainframes.com/viewtopic.php?t=15976&highlight=wer244a
http://www.ibmmainframes.com/viewtopic.php?t=18206&postdays=0&postorder=asc&start=15
http://www.ibmmainframes.com/viewtopic.php?t=20141&highlight=wer244a
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Sep 30, 2009 5:00 pm    Post subject:
Reply with quote

balimanja, You specified 10,485 in the OUTREC statement. This says that each record must be at least 500 bytes long. While the message WER244A, tells you that one or more of your variable-length records is not that long.

And what about 9th posistion, per your card?

I'm not connected just now -- but it seems you can work around by keeping these things in mind.

Just for try,You may use,
Code:
OUTREC BUILD=(1:1,4,   
             5:5,4,   
             10:10X,   
             20:20)
This says that each record must be at least 16 (am I correct?) bytes long, which I suspect they are.
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 38
Location: Bangalore

PostPosted: Wed Sep 30, 2009 5:48 pm    Post subject:
Reply with quote

Thanks Ekta & expat. It seems to be working. But there was one thing that I forgot to mention. This file has a header and trailer.

Header:
Code:

----+----1----+----2----+----3----+----4
H AL0909257563


Trailer:
Code:
----+----1----+----2----+----3----+----4
T 0909250000074508


The header lasts until 14th data column (19th actual column)
As I was trying your suggestions, I noticed that the code was working for only those columns that were within the header.

Code:
Sort fields=copy
outrec fields=(5,4,10X,16:9)


The above code would work only until 15 (actual column) i.e.

Code:
Sort fields=copy
outrec fields=(5,4,10X,16:15)


Beyond this, it would throw an error as I had mentioned above. I have a fair idea to byepass this and satisfy my above requirement of including spaces. But I can't think of doing it without using 3 steps associated with one invocation of SYNCTOOL & TOOLIN statements. Please let me know if there is any way in which I could do it more efficiently.

I will post the method along with the result soon.

Thank you all very much.
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 38
Location: Bangalore

PostPosted: Wed Sep 30, 2009 5:54 pm    Post subject:
Reply with quote

Yes Anuj, I realised that the error was because of the header which was the shorter one... I am trying to find a way to byepass this problem i.e. exclude header and trailer while applying the logic that inserts spaces as per the requirement.

Thanks again... icon_smile.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Sep 30, 2009 7:11 pm    Post subject:
Reply with quote

Glad to hear that you figure it out... icon_smile.gif. And for this
Quote:
exclude header and trailer while applying the logic that inserts spaces as per the requirement
search the forum -- you may find multiple working examples in JCL and DFSORT/ICETOOL part of the forum.
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 38
Location: Bangalore

PostPosted: Thu Oct 01, 2009 2:59 pm    Post subject:
Reply with quote

Hello everyone,

Here is what I have done so far.

Code:

  OUTFIL FNAMES=OUT1,INCLUDE=(5,1,CH,EQ,C'H'),  <-HEADER
  BUILD=(1,18)                               
  OUTFIL FNAMES=OUT2,INCLUDE=(5,1,CH,EQ,C'T'),  <-TRAILER   
  BUILD=(1,22)                               
  OUTFIL FNAMES=OUT3,INCLUDE=(5,1,CH,EQ,C'D'),  <-OTHER TYPE REC
  BUILD=(1:1,4,                               
         5:5,118,                             
         123:50X'FF',                         
         173:123,6)                           
  OUTFIL FNAMES=OUT4,SAVE,  <-REMAINING DATA RECORDS
  BUILD=(1:1,4,                               
         5:5,38,                             
         43:10X,                             
         53:43,20,                           
         73:10X,                             
         83:63,20,                           
         103:10X,                             
         113:83,20, 
         133:10X,   
         143:103,20,
         163:10X,   
         173:123,332)



Now I have split up the input records, inserted space in them (well it is a little different that what I had initially asked for icon_wink.gif .)

Here is the TOOLIN for the above CNTL.

Code:

  COPY FROM(IN1) USING(LGC1)


Now that all the data are in separate files, I am stuck as to how to merge the Header, 'the Other Type Record', Data records and the Trailer (in the mentioned order). The Final file needs to be sorted as (2,13,CH,A).

Please let me know as to how to merge them together.

Header:
Code:

H AL0909297566


Trailer:
Code:

T 0909290000072801
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 38
Location: Bangalore

PostPosted: Thu Oct 01, 2009 3:09 pm    Post subject:
Reply with quote

Could it be done within the same SYNCTOOL step using another CNTL? I am sorry that I forgot to mention that.
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 38
Location: Bangalore

PostPosted: Thu Oct 01, 2009 4:38 pm    Post subject:
Reply with quote

Thank you all for your help. I have been able to complete what was needed. A new learning since the file was a VB. Had it been a FB, I guess it wouldn't have caused that much of a problem... icon_smile.gif icon_wink.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Oct 01, 2009 4:53 pm    Post subject:
Reply with quote

It would be nice, for the benefit of others, if you post the final solution you've used.
Back to top
View user's profile Send private message
balimanja

New User


Joined: 14 Aug 2007
Posts: 38
Location: Bangalore

PostPosted: Wed Oct 07, 2009 3:48 pm    Post subject:
Reply with quote

Sorry for the delay since I had to put that into production. Here is what I did:

Code:

//TESTONE1 JOB (T),'MANJUNATH',CLASS=S,NOTIFY=&SYSUID,
//         MSGCLASS=H
//**********************************************************************
//STEP010 EXEC PGM=IEFBR14
//DEL1    DD DSN=FILE.TEMP1,
//           DISP=(MOD,DELETE),
//           UNIT=SYSDA,SPACE=(TRK,0)
//DEL2    DD DSN=FILE.TEMP2,
//           DISP=(MOD,DELETE),
//           UNIT=SYSDA,SPACE=(TRK,0)
//DEL3    DD DSN=FILE.TEMP3,
//           DISP=(MOD,DELETE),
//           UNIT=SYSDA,SPACE=(TRK,0)
//DEL4    DD DSN=FILE.TEMP4,
//           DISP=(MOD,DELETE),
//           UNIT=SYSDA,SPACE=(TRK,0)
//DEL5    DD DSN=FILE.TEMP5,
//           DISP=(MOD,DELETE),
//           UNIT=SYSDA,SPACE=(TRK,0)
//DEL6    DD DSN= FILE.FIXEDTHR,
//           DISP=(MOD,DELETE),
//           UNIT=SYSDA,SPACE=(TRK,0)
//**********************************************************************
//S020     EXEC PGM=SYNCTOOL
//DFSMSG   DD  SYSOUT=*
//TOOLMSG  DD  SYSOUT=*
//IN1      DD  DSN=INPUT.FILE,
//             DISP=SHR
//OUT1     DD  DSN=FILE.TEMP1,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,SPACE=(CYL,(100,100),RLSE)
//OUT2     DD  DSN=FILE.TEMP2,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,SPACE=(CYL,(100,100),RLSE)
//OUT3     DD  DSN=FILE.TEMP3,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,SPACE=(CYL,(100,100),RLSE)
//OUT4     DD  DSN=FILE.TEMP4,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,SPACE=(CYL,(100,100),RLSE)
//MERGE1   DD  DSN=*.OUT3,
//             VOL=REF=*.OUT3,
//             DISP=(SHR,KEEP,KEEP)
//         DD  DSN=*.OUT4,
//             VOL=REF=*.OUT4,
//             DISP=(SHR,KEEP,KEEP)
//OUT5     DD  DSN=FILE.TEMP5,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,SPACE=(CYL,(100,100),RLSE)
//MERGE2   DD  DSN=*.OUT1,
//             VOL=REF=*.OUT1,
//             DISP=(SHR,KEEP,KEEP)
//         DD  DSN=*.OUT5,
//             VOL=REF=*.OUT5,
//             DISP=(SHR,KEEP,KEEP)
//         DD  DSN=*.OUT2,
//             VOL=REF=*.OUT2,
//             DISP=(SHR,KEEP,KEEP)
//OUT6     DD  DSN=FILE.FIXEDTHR,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,SPACE=(CYL,(100,100),RLSE)
//TOOLIN   DD  *
  COPY FROM(IN1) USING(LGC1)           
  SORT FROM(MERGE1) TO(OUT5) USING(LGC2)
  COPY FROM(MERGE2) TO(OUT6) USING(LGC3)
//LGC1CNTL DD  *
      OUTFIL FNAMES=OUT1,INCLUDE=(5,1,CH,EQ,C'H'),
   BUILD=(1,18)                               
   OUTFIL FNAMES=OUT2,INCLUDE=(5,1,CH,EQ,C'T'),
   BUILD=(1,22)                               
   OUTFIL FNAMES=OUT3,INCLUDE=(5,1,CH,EQ,C'D'),
   BUILD=(1:1,4,                               
          5:5,118,                             
          123:50X'FF',                         
          173:123,6)                           
   OUTFIL FNAMES=OUT4,SAVE,                   
   BUILD=(1:1,4,                               
          5:5,38,                             
          43:10X,                             
          53:43,20,                           
          73:10X,                             
          83:63,20,                           
          103:10X,                             
          113:83,20, 
          133:10X,   
          143:103,20,
          163:10X,   
          173:123,332)
//LGC2CNTL DD  *
   SORT FIELDS=(6,13,CH,A,19,4,CH,A)   <-This was some misc. req.
//LGC3CNTL DD  *
  SORT FIELDS=COPY 


I hope it will be of use to someone.

Thank you all for your help.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 1 Fri Dec 02, 2016 9:47 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us