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

position, start pos, length of columns using variable values


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

New User


Joined: 04 May 2012
Posts: 34
Location: Brazil

PostPosted: Fri Jun 21, 2019 8:47 pm
Reply with quote

Hi everyone...

Could we use position and length field (p,n) in syncsort as a result of
arithmetic addition or subtraction? I mean, where we would use...

as an example:
.
.
.
// EXPORT SYMLIST=(pp,sz)
.
.
//SYSIN DD *,SYMBOLS=EXECSYS
.
.
.
... ,(OVERLAY=(&pp+1:100,15,... or
... ,(BUILD=(&pp+3:100,(&sz+5),...


resulting...
... ,(OVERLAY=(31:100,15,... or
... ,(BUILD=(33:100,25,...


where: &pp values "30", &sz values "20"
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Fri Jun 21, 2019 9:16 pm
Reply with quote

1) Why not to try it in your own test?

2) Why not to read any of SORT manuals?
Back to top
View user's profile Send private message
juares castro

New User


Joined: 04 May 2012
Posts: 34
Location: Brazil

PostPosted: Fri Jun 21, 2019 10:17 pm
Reply with quote

Hi Sergeyken!
Before post here, I tried in my own test. Believe me.
And I did not get any mention about using variable position or length in Sort manuals regarding SORT, INREC, OUTREC,... statements.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Fri Jun 21, 2019 10:55 pm
Reply with quote

juares castro wrote:
Hi Sergeyken!
Before post here, I tried in my own test. Believe me.
And I did not get any mention about using variable position or length in Sort manuals regarding SORT, INREC, OUTREC,... statements.

That only proves to me again, and again, that you are not able to make any logical conclusion from existing facts. This is very-very typical problem for modern "experts in computer games" who claim themselves as "Senior Software Architecture Experts".

1) If you tried it in your own tests, where are the results of your attempts???

2) Do you have any minor idea, how the variables in your examples are to be handled, and which components are involved?

3) The JCL-variables can only be substituted by one of JES component as part of in-stream text. At this moment, JES has no idea about the meaning of any characters/symbols/operations/whatever else around this and only this JCL-variable name, starting from an ampersand. Any
BUILD=(&pp+1:100,....
has no meaning for JES except the part of &pp detected by its parser. It must be obvious for anyone who had ever learned the basics of computer programming.
So, at this stage only specific value of variable &pp can be substituted as character string in the middle of in-stream data supposed in the future to become an utility control statement.

4) At step execution time, the utility (SORT, or any other) just reads the updated in-stream text with JCL-parameters already replaced by their values earlier by JES. The utility can read this text only as
BUILD=(123+1:100,...
You can easily find out from SORT manual(s) if this syntax is allowed, or not? In theory, a smart enough utility would be able to handle expressions like this; but AFAIK the current versions of SORT utilities do not.

5) Again, when you "tried your own test", what are the results? I expect that everything I explained above (spending my own time for free!) must be obviously concluded from your test results.
Back to top
View user's profile Send private message
juares castro

New User


Joined: 04 May 2012
Posts: 34
Location: Brazil

PostPosted: Fri Jun 21, 2019 11:25 pm
Reply with quote

Sergeyken,
I just trying to know if that is possible.
I do not know about your time or how expert I am or You are.
Please, do not spend your time.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Sat Jun 22, 2019 12:01 am
Reply with quote

juares castro wrote:
Sergeyken,
I just trying to know if that is possible.
I do not know about your time or how expert I am or You are.
Please, do not spend your time.

This is the major problem:

You are not trying to know if that is possible.

You are trying to make others to do your own job, because - despite of your current occupation, and position - you cannot make even elementary logical conclusion from obvious facts.

You even do not try to do it, and probably you never did this in the whole your life.

Once again: where are the results of your attempts to do something?????
Back to top
View user's profile Send private message
juares castro

New User


Joined: 04 May 2012
Posts: 34
Location: Brazil

PostPosted: Sat Jun 22, 2019 2:30 am
Reply with quote

Hi again...
Here a simple teste I tryed execute. My requirement is a little bit strong, but needing flexible positons and lengths as below:

Code:
// EXPORT SYMLIST=(KL)                                       
//*                                                           
// SET KL=5                                                   
//*                                                           
//STEP10 EXEC PGM=SYNCSORT,REGION=7M                         
//SORTIN   DD *                                               
12345678901234567890XXXXXXXXXXXXXXXXXXX                       
23456789012345678901YYYYYYYYYYYYYYYYYYY                       
89012345678901234567ZZZZZZZZZZZZZZZZZZZ                       
45678901234567890123AAAAAAAAAAAAAAAAAAA                       
12345678901234567890BBBBBBBBBBBBBBBBBBB                       
78901234567890123456CCCCCCCCCCCCCCCCCCC                       
/*                                                           
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *,SYMBOLS=EXECSYS                               
  SORT FIELDS=(1,&KL,A),FORMAT=BI                             
  OUTREC FIELDS=((+&KL,ADD,+1):(+&KL,ADD,+1),(+80,SUB,+&KL)) 
//SYSOUT   DD SYSOUT=*                                       
//*                                                           
//                                                           

 SYNCSORT FOR Z/OS  2.1.7.0R

 SYSIN :                                                                       
   SORT FIELDS=(1,5,A),FORMAT=BI                                               
   OUTREC FIELDS=((+5,ADD,+1):(+5,ADD,+1),(+80,SUB,+5))                         
                             *                                                 
 WER813I  INSTALLATION OPTIONS IN MFXPRMCT WILL BE USED                         
 WER268A  OUTREC STATEMENT  : SYNTAX ERROR                                     
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 


As You can see, in OUTREC statement We have: "p:s,e" (position:start,end)
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Mon Jun 24, 2019 9:00 pm
Reply with quote

Simple test is to see if it works by Hardcoding the +5 value. if it works then change it dynamic one. This way you can be sure the syntax is correct.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Jun 25, 2019 5:49 pm
Reply with quote

Code:
  SORT FIELDS=(1,5,A),FORMAT=BI
  OUTREC OVERLAY=(1,5C' ')

is equivalent to
Code:
  SORT FIELDS=(1,5,A),FORMAT=BI
  OUTREC FIELDS=(6:6,75)

and much easier to code:
Code:
  SORT FIELDS=(1,&KL,A),FORMAT=BI
  OUTREC OVERLAY=(1:&KL.C' ')   
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Tue Jun 25, 2019 6:51 pm
Reply with quote

juares castro wrote:
Hi again...
Here a simple teste I tryed execute. My requirement is a little bit strong, but needing flexible positons and lengths as below:

Code:
  SORT FIELDS=(1,&KL,A),FORMAT=BI                             
  OUTREC FIELDS=((+&KL,ADD,+1):(+&KL,ADD,+1),(+80,SUB,+&KL)) 

 SYNCSORT FOR Z/OS  2.1.7.0R

 SYSIN :                                                                       
   SORT FIELDS=(1,5,A),FORMAT=BI                                               
   OUTREC FIELDS=((+5,ADD,+1):(+5,ADD,+1),(+80,SUB,+5))                         
                             *                                                 
 WER813I  INSTALLATION OPTIONS IN MFXPRMCT WILL BE USED                         
 WER268A  OUTREC STATEMENT  : SYNTAX ERROR                                     
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 


As You can see, in OUTREC statement We have: "p:s,e" (position:start,end)

Oh, poor juares castro…

You do not have in your example any "p:s,e" (position:start,end)

What you do have is ((expression):(expression),(expression))

This is an absolutely different entity taken from completely different place of the SORT manual.

This new format (+&KL,ADD,+1) is even more senseless than previously used (&KL+1)

I'm sorry, but I need to recommend you again: start learning the basic principles of computer programming. You can start from re-reading my previous detailed explanation.
So far you do not understand even the simplest syntax diagrams from utility manuals...
Back to top
View user's profile Send private message
juares castro

New User


Joined: 04 May 2012
Posts: 34
Location: Brazil

PostPosted: Wed Jun 26, 2019 12:34 am
Reply with quote

Oh, poor Sergeyken!!!
You still do not understand what was my question...
And it is there all time. But you are preoccupied to be impolite.
My point is exactly what I tryed write: intead have fixed values to "position:", "start position" and "length" (p:s,l) I am trying to know if it is possible or not using a variable expression on that specification. Simple: ( )YES ( )NO.
And please, I am not good spending your precious time. To you, end.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Jun 26, 2019 7:32 pm
Reply with quote

Another approach is to dynamically build your sort cards.

In my example below I use a Rexx exec to build the sort cards.

Not in a single step, but who cares. It gets the job done.

Code:
//* CREATE SORT CARD WITH POSITIONS START END
//SYMBOLIC SET POS0=5
//STEP1    EXEC PGM=IRXJCL,PARM='SETPOS &POS0'
//SYSEXEC    DD DSN=MY.REXX.LIB,DISP=SHR
//SYSTSPRT   DD SYSOUT=Z
//CARDOUT    DD DSN=TEMP.&SYSUID..SORTCARD,
//           DISP=(NEW,CATLG,DELETE),
//           UNIT=SYSDA,
//           SPACE=(TRK,(1,1)),
//           BLKSIZE=0,
//           LRECL=80,
//           RECFM=FB
//*
//STEP10 EXEC PGM=SYNCSORT,REGION=7M
//SORTIN   DD *
12345678901234567890XXXXXXXXXXXXXXXXXXX
23456789012345678901YYYYYYYYYYYYYYYYYYY
89012345678901234567ZZZZZZZZZZZZZZZZZZZ
45678901234567890123AAAAAAAAAAAAAAAAAAA
12345678901234567890BBBBBBBBBBBBBBBBBBB
78901234567890123456CCCCCCCCCCCCCCCCCCC
/*
//SORTOUT  DD SYSOUT=Z
//SYSIN    DD DSN=TEMP.&SYSUID..SORTCARD,DISP=SHR
//SYSOUT   DD SYSOUT=Z


Rexx Code

Code:
/* REXX EXEC FOR SETTING POSITION START AND END          */

ARG POS0

POS1 = POS0 + 1
START = POS0 + 1
ENDPOS = 80 - POS0

O.  = ''
O.1 = '  SORT FIELDS=(1,'POS0',A),FORMAT=BI'
O.2 = '  OUTREC FIELDS=('POS1':'START','ENDPOS')'

"EXECIO 2 DISKW CARDOUT (STEM O. OPEN FINIS"

EXIT
Back to top
View user's profile Send private message
juares castro

New User


Joined: 04 May 2012
Posts: 34
Location: Brazil

PostPosted: Thu Jun 27, 2019 3:15 am
Reply with quote

Thanks Daveporcelan!
That is a good idea!
I will try do that.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Tue Jul 09, 2019 9:21 pm
Reply with quote

You can also try this two step solution,
1. You can use the value 5 in SORT IN and in SORTOUT try BUILD the SORT CARD
2. Use the SORTCARD created in step1.

So whenever you want to change the input value change the SORTIN Data Set and edit to new value.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Thu Jul 11, 2019 11:43 pm
Reply with quote

juares castro wrote:
Oh, poor Sergeyken!!!
You still do not understand what was my question...
And it is there all time. But you are preoccupied to be impolite.
My point is exactly what I tryed write: intead have fixed values to "position:", "start position" and "length" (p:s,l) I am trying to know if it is possible or not using a variable expression on that specification. Simple: ( )YES ( )NO.
And please, I am not good spending your precious time. To you, end.

My point was: the answer to your question is obvious to anyone who has ever opened the JCL+SORT manuals.

I'm 150% sure you never did it. You always ask people around you: "Please, which button do I need to click to perform my job?"

Bye, all the best
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

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top