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

Adding Quotes to Input Records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Wed Mar 05, 2008 11:02 pm
Reply with quote

Hi,

I have an input file with Account ID from 1st to 16th colomn. I want to add single quotes for each input record in 1st and 17th colomn.

Input file looks like below.

0000000000000001
0000000000000002
0000000000000003

Output should look like below:

'0000000000000001'
'0000000000000002'
'0000000000000003'

We have DFSORT. Can we achieve this using DFSORT?

Record length of my Input and output files 23 and Record Format is FB.

Regards,
KSK
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Mar 05, 2008 11:14 pm
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (FB/23)
//SORTOUT DD DSN=...  output file (FB/23)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(C'''',1,16,C'''',23:X)
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Thu Mar 06, 2008 10:48 am
Reply with quote

Hi Frank,

Thanks very much for your solution. It is working fine.

I have one more requirement here. I also want to add ,(comma) after last quote of each record.

i.e. output should look like below.

'0000000000000001',
'0000000000000002',
'0000000000000003'

Please note that last record should not have comma but all other prior records should have.

I tried with the following sort card but it is giving comma for last record also.

INREC BUILD=(C'''',1,16,C'''',C',',23:X)

And my actual output records are showing like below.

'0010089589511343',
'0010089589511343',
'0010089589562369',
'0010089589562469',

Last highlited comma should not come in my output.

Please let me know the solution.


Regards,
KSK
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Mar 06, 2008 9:33 pm
Reply with quote

Here's a DFSORT job for your new requirement:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (FB/23)
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
    BUILD=(80X),
    TRAILER1=('LASTRCD,+',COUNT=(M11,LENGTH=8))
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file (FB/23)
//SORTOUT DD DSN=...  output file (FB/23)
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=23,
    IFTHEN=(WHEN=INIT,
      BUILD=(C'''',1,16,C''',',24:SEQNUM,8,ZD)),
    IFTHEN=(WHEN=(24,8,ZD,EQ,LASTRCD),
      OVERLAY=(19:X))
/*
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Tue Mar 18, 2008 11:46 am
Reply with quote

Thanks Frank. It worked fine.

Regards,
KSK
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top