Page 1 of 1

Adding spaces in a REFORMAT FIELDS statement?

PostPosted: Thu Jun 10, 2010 6:28 pm
by mberger
I am attempting to join 2 files by key, in the output I want to include elements from both files but also want to insert spaces in some areas.

For example:

File 1 contains this record:
023 123 Main Street

File 2 contains this record:
023 Joe Smith

If 023 was the key value, I am joining these two files and would want to create the following record:
023 (many spaces) Joe Smith (many spaces) 123 Main Street

The following statement would combine the data properly, but not in the format I desire.
REFORMAT FIELDS=(F2:1,13,F1:5,15)

Is there a way to add spaces or to indicate where I want each field to begin? I know in a standard sort, you can specify the output position in the OUTFIL OUTREC statement, or use the X to represent a blank (or #X for multiple blanks).

Re: Adding spaces in a REFORMAT FIELDS statement?

PostPosted: Thu Jun 10, 2010 7:48 pm
by Alissa Margulies
Additional characters cannot be introduced within the REFORMAT statement. Therefore, you can add an OUTREC or OUTFIL OUTREC statement to the JOIN application. For example:
//SYSIN DD *
  .
  .
  .
  REFORMAT FIELDS=(F2:1,13,F1:5,15)
  SORT FIELDS=COPY
  OUTREC BUILD=(1,3,10X,4,10,10X,14,15)
/*

Re: Adding spaces in a REFORMAT FIELDS statement?

PostPosted: Wed Mar 28, 2012 11:07 pm
by masterchecho
Hi ,

It is possible to add the value of a parameter in the outrec build instead of spaces or Zeroes ... ?

In the previous example

//SYSIN DD *
.
.
.
REFORMAT FIELDS=(F2:1,13,F1:5,15)
SORT FIELDS=COPY
OUTREC BUILD=(1,3,10X,4,10,10X,14,15) ==> here is where i need to add a parameter instead of spaces or zeroes...

OUTREC BUILD=(1,3,&VAriable1,4,10,10X,14,15) ==> where variable1 is a parameter which contains a date , I dont need a system date which is supported by outrec, instead this parameter contains a date in YYMMDD
/*

Thanks a lot
Sergio

Re: Adding spaces in a REFORMAT FIELDS statement?

PostPosted: Wed Mar 28, 2012 11:23 pm
by BillyBoyo
Please next time start a new topic for a new question. You can always refer to the original if useful to what you are saying.

Yes. I suggest you look at Symbols/SYMNAMES in your documentation. Where is the date coming from?

Re: Adding spaces in a REFORMAT FIELDS statement?

PostPosted: Thu Mar 29, 2012 12:04 am
by masterchecho
BillyBoyo wrote:Please next time start a new topic for a new question. You can always refer to the original if useful to what you are saying.

Yes. I suggest you look at Symbols/SYMNAMES in your documentation. Where is the date coming from?



OK, next time i will open a new topic.

Regarding the date, the date is coming from the jcl as a parameter and it is passed to the proc, and inside this proc the date is used to "build" dataset names...



This is my code :

JOINKEYS FILE=F1,FIELDS=(1,4,BI,A),SORTED
JOINKEYS FILE=F2,FIELDS=(1,4,BI,A),SORTED
JOIN UNPAIRED,F2,ONLY
REFORMAT FIELDS=(F2:1,100)
SORT FIELDS=COPY
OUTREC BUILD=(1,15,S'&PKZDATE',75X)

But is nor working, is not resolving &PKZDATE and is giving me an error in the "S"

I've checked what you mentioned about the Symbols, and it seems that i have to create a pds member wich contains the parameter because the parameter is not a system symbol...

Regards
Sergio

Re: Adding spaces in a REFORMAT FIELDS statement?

PostPosted: Thu Mar 29, 2012 12:23 am
by BillyBoyo
What version of Synsort are you on? If not "current", I don't think that you can directly access the parameter/set from JCL.

You'd then need to find "something else" which can take the parameter and write it to a dataset. From that you can generate a Symbol/SYMNAME with that value, and use that in your sort.

If you are current, it will be in your documentation for Syncsort how take the parameter/set value.

Re: Adding spaces in a REFORMAT FIELDS statement?

PostPosted: Thu Mar 29, 2012 6:24 pm
by masterchecho
Is not current, so i've created a rexx which create a member in a pds , and this member contains the sort card with the parameters resolved.


Thanks a lot for your help
Sergio

Re: Adding spaces in a REFORMAT FIELDS statement?

PostPosted: Thu Mar 29, 2012 6:55 pm
by BillyBoyo
Thanks for letting us know.

Raise the paperwork to simplify it when/if you get the later release of Syncsort.

Re: Adding spaces in a REFORMAT FIELDS statement?

PostPosted: Fri Mar 30, 2012 4:50 am
by BillyBoyo
Apologies to any readers of this thread. I can find nothing to support my wild idea that the current release of Syncsort supports the supply of parameters from the JCL into the sort control cards. :oops: